Tous les articles par jb

Note sur Eyes Of Network

notify email

  • Ajout de l’option -r pour forcer l’envoie
/usr/bin/printf "%b" "***** Nagios  *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate/Time: $LONGDATETIME$\\n\\nAdditional Info:\\n\\n$SERVICEOUTPUT$" | /bin/mail -s "Services $SERVICESTATE$ alert for $HOSTNAME$/$SERVICEDESC$!" -r $CONTACTEMAIL$ $CONTACTEMAIL$
  • email ne fonctionne pas, voir /srv/eyesofnetwork/nagios-3.5.1/etc/
define contact {
contact_name admin
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
host_notification_commands notify-host-by-email,notify-service-by-email
service_notification_commands notify-host-by-email,notify-service-by-email
can_submit_commands 1
retain_status_information 1
email admin[at]domaine.local; <= on vérifie cette ligne
}

check_update_ipfire

snmpwalk -v2c -c public 127.0.0.1 nsExtendOutput1
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."update" = STRING: 0
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."echotest" = STRING: hello world
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."update" = STRING: 0
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."echotest" = STRING: hello world
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."update" = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."echotest" = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendResult."update" = INTEGER: 0
NET-SNMP-EXTEND-MIB::nsExtendResult."echotest" = INTEGER: 0
snmptranslate -On NET-SNMP-EXTEND-MIB::nsExtendOutput1Line.\"update\"
.1.3.6.1.4.1.8072.1.3.2.3.1.1.6.117.112.100.97.116.101 <= GOOD
  • Command à créer dans EON
$USER1$/check_snmp -H $HOSTADDRESS$ -P 1 -C $USER2$ -o .1.3.6.1.4.1.8072.1.3.2.3.1.1.6.117.112.100.97.116.101 -l "Update" -s 0 -c 2
  • Ce qui donnerai dans un fichier texte normal
define command {
    command_name    check_ipfire_update
    command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -P 1 -C $USER2$ -o .1.3.6.1.4.1.8072.1.3.2.3.1.1.6.117.112.100.97.116.101 -s 0 -c 2 -l "Update"
}
  • debug : /srv/eyesofnetwork/nagios-3.5.1/plugins/debug
#!/bin/bash
# Attention au caractère ! dans la commande nagios.
DATE=$(date +%d-%m-%Y-%H-%M-%S)
DIR=/tmp/nagios-${DATE}
echo ${@} > ${DIR}
${@}

OCS Inventory

Installation

Serveur

Paquets

apt-get install apache2 mysql-server  php5 libapache2-mod-php5 php5-mysql php5-curl php5-json php5-gd php5-mcrypt \
php5-msgpack  php5-memcached php5-intl php5-sqlite php5-gmp php5-geoip php-soap libphp-pclzip make perl libxml-simple-perl \
libdbi-perl libdbd-mysql-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl libxml-perl libapache2-mod-perl2 libio-compress-perl

Module PERL

cpan -f Archive::Zip
cpan -f YAML
mkdir /usr/include/apache2
cpan -f Apache2::SOAP
cpan -f XML::Entities

Base de données

  • avec option -pMotdePasse Coller
mysql -u root -pMotdePasse
CREATE DATABASE ocs;
CREATE USER 'ocs'@'localhost';
UPDATE mysql.user SET password=PASSWORD('MotdePasseBDOCS') WHERE user='ocs';
GRANT ALL PRIVILEGES ON ocs . * TO 'ocs'@'localhost';
FLUSH PRIVILEGES;

# et mettre à jour le connecteur à la database.. attention dans EON, il y a 6 fichier à vérifier dont 4 dans /etc/httpd/conf.d/[z]... nano ./ocsinventory-reports-2.2/ocsreports/dbconfig.inc.php nano /etc/httpd/conf.d/ocsinventory-server.conf nano /srv/eyesofnetwork/ocsinventory-reports-2.2/ocsreports/ipdiscover-util.pl wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.3.1/OCSNG_UNIX_SERVER-2.3.1.tar.gz cd OCSNG_UNIX_SERVER-2.3.1/ ./setup.sh

Modifier les mots de passe

nano /etc/apache2/conf-enabled/z-ocsinventory-server.conf
nano /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl
nano /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php

Apaches

cat >> /etc/apache2/sites-enabled/000-default.conf << EOF
Alias / "/usr/share/ocsinventory-reports/ocsreports/"
   <Directory "/usr/share/ocsinventory-reports/ocsreports/">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
   </Directory>
EOF
a2enconf z-ocsinventory-server.conf
/etc/init.d/apache2 restart

php

  • Modifier le fichier php.ini

nano /etc/php5/apache2/php.ini

  • régler les variables :
post_max_size
upload_max_filesize

Client

Debian

  • Agent
wget https://github.com/OCSInventory-NG/UnixAgent/releases/download/2.4/Ocsinventory-Unix-Agent-2.4.2.tar.gz



mkdir /var/log/ocs/
tar xvf Ocsinventory-Unix-Agent-2.4.2.tar.gz
cd Ocsinventory-Unix-Agent-2.4.2/

apt install libmodule-install-perl dmidecode libxml-simple-perl libnet-ip-perl libwww-perl libdigest-md5-perl libdata-uuid-perl
apt install libcrypt-ssleay-perl libnet-snmp-perl libproc-pid-file-perl libproc-daemon-perl net-tools libsys-syslog-perl pciutils smartmontools read-edid nmap libnet-netmask-perl
perl Makefile.PL
make
make install

  • Agent Deployment (?)
https://github.com/OCSInventory-NG/Packager-for-Windows/releases/download/2.3/OCSNG-Windows-Packager-2.3.zip

Windows

https://github.com/OCSInventory-NG/Agent-Deployment-Tool/releases/download/2.3/OCSNG-Agent-Deploy-Tool-2.3.zip