Installer PNP4Nagios et Nagvis sur Debian 8
La suite de ce tutoriel sur la supervision d’un parc informatique avec l’installation de PNP4Nagios pour les graphs et Nagvis pour le côté visuel
Installation de PNP4Nagios
On récupère les sources :
wget "https://sourceforge.net/projects/pnp4nagios/files/latest" -O pnp4nagios.latest.tar.gz tar xzvf pnp4nagios.latest.tar.gz cd pnp4nagios-0.6.25 ./configure --with-httpd-conf=/etc/apache2/conf-available make all make install make install-webconf<code></code> make install-config make install-init
Ensuite nous devons modifier le fichier de configuration d’Apache2 :
vim /etc/apache2/conf-available/pnp4nagios.conf
Il faut activer le module rewrite pour Apache2
a2enmod rewrite
Et enfin activer le site PNP4Nagios
a2enconf pnp4nagios
On redémarre Apache2
systemctl restart apache2.service
Rendez vous sur http://addr.ip/pnp4nagios/
Vous pouvez maintenant supprimer le fichier install.php :
rm /usr/local/pnp4nagios/share/install.php
Ensuite il faut configurer nagios pour que les perfdatas des plugins trouvent PNP4Nagios :
A la fin du fichier /usr/local/nagios/etc/nagios.cfg rajoutez :
# Bulk / NPCD mode # process_performance_data=1 # *** the template definition differs from the one in the original nagios.cfg # service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$ service_perfdata_file_mode=a service_perfdata_file_processing_interval=15 service_perfdata_file_processing_command=process-service-perfdata-file # *** the template definition differs from the one in the original nagios.cfg # host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$ host_perfdata_file_mode=a host_perfdata_file_processing_interval=15 host_perfdata_file_processing_command=process-host-perfdata-file
Ensuite dans le fichier /usr/local/nagios/etc/objects/commands.cfg, rajoutez à la fin :
# Bulk with NPCD mode # define command { command_name process-service-perfdata-file command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$ } define command { command_name process-host-perfdata-file command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$ }
Ensuite il vous faut configurer le service npcd
usermod -G www-data nagios /etc/init.d/npcd start update-rc.d npcd defaults systemctl restart nagios.service
Rendez vous sur http://votre.ip/pnp4nagios et admirez les premiers graphs
Installation de Nagvis
Commencez par installer le paquet php5-sqlite
aptitude install php5-sqlite
Puis on commence l’installation :
wget http://www.nagvis.org/share/nagvis-1.8.5.tar.gz tar xzvf nagvis-1.8*/tar.gz cd nagvis-1.8.5 chmod +x install.sh ./install.sh
Laissez vous guider par l’installateur, vous pouvez laisser les réponses par défaut
A la question « Please enter your MKLivestatus socket » vous devez entrer : unix:/var/lib/nagios/rw/livestatus
A la fin de l’installation commencez par modifier le fichier de configuration d’Apache2 /etc/apache2/conf-available/nagvis.conf
Il faut remplacer Order allow,deny et Allow from all par la seule ligne Require all granted
Ensuite il faut activer le site et relancer Apache2
a2enconf nagvis service apache2 reload
Puis rendez vous sur http://votre.ip/nagvis/
Les identifiants par défaut sont admin/admin
Bonjour ,
Merci pour ton tuto il vrai excellant . Actuellement je suis en pleine installe de Nagios . Dans ton tuto dur la parti PNP4nagios . Tu nous dit qu’il faut modifier le fichier pnp4nagios.conf vim /etc/apache2/conf-available/pnp4nagios.conf
Désolé je ne vois pas ce que je doit modifier
Peux-tu m’aider stp.
Cordialement
Bonjour,
Pour quelqu’un qui ne maitriserai pas trop les services web sous linux, il manque certains points sur la question soulevée juste au dessus et sur ce qui suit dans le tuto.
Sinon merci beaucoup pour toutes ses informations pour une installation qui tourne !