PNP4Nagios : Grapher ses alertes Nagios
Contents
1 Introduction
PNP is an addon to Nagios which analyzes performance data provided by plugins and stores them automatically into RRD-databases (Round Robin Databases, see RRD Tool).
2 Prerequisites
First, create a folder where to unzip the installation files. Here, we are going to use /etc/nagios3/pnp4nagios :
mkdir /etc/nagios3/pnp4nagios cd /etc/nagios3/pnp4nagios |
Then get the file, unzip and go into the folder :
wget http://downloads.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.0.tar.gz?use_mirror=freefr cd pnp4nagios-0.6.0 |
Activate the Apache2 rewrite module :
a2enmod rewrite /etc/init.d/apache2 restart |
Edit the php5 conf file in /etc/php5 on this line :
/etc/php5 |
magic_quotes_gpc = Off |
If not installed yet, install GCC (C compiler)
aptitude |
aptitude install gcc |
3 Installation
Configure the installation, using the folder you want to install pnp4nagios in :
configure |
./configure --prefix=/etc/nagios3/pnp4nagios --with-nagios-user=nagios --with-nagios-group=nagios |
Launch every make command :
make |
make all make install make install-webconf make install-config make install-init |
4 Configuration
In the nagios generic services file add :
/etc/nagios3/conf.d/generic-services.cfg |
... define command { command_name process-service-perfdata command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl } |
And in the generic hosts file add :
/etc/nagios3/conf.d/generic-host.cfg |
define command { command_name process-host-perfdata command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA } |
Edit the nagios.cfg file and be sure those line are uncommented :
/etc/nagios3/nagios.cfg |
process_performance_data=1 service_perfdata_command=process-service-perfdata host_perfdata_command=process-host-perfdata |
In any service or host configuration file, add (use generic-*.cfg for example) :
Now for any host and service you want to use pnp4nagios with, on its "use" line, add this for a host :
host-pnp
and for a service :
srv-pnp
Example :
... define service{ use generic-services,srv-pnp |
You can add it on a generic host or service used by a group of hosts or services. This will be inherited.
4.1 Onmouseover graphs in cgi interface
Copy the ssi files in the pnp4nagios contrib folder (pnp4nagios-0.6.0/contrib/ssi/*) in the nagios ssi folder (/usr/share/nagios3/htdocs/ssi/) :
cp -Rf /etc/nagios3/pnp4nagios/pnp4nagios-0.6.0/contrib/ssi/*.ssi /usr/share/nagios3/htdocs/ssi/ rm -Rf /etc/nagios3/pnp4nagios/pnp4nagios-0.6.0/ |
Finally, restart apache2 and nagios and everything will work fine. You can see the PNP4Nagios interface to : http://nagios-srv/pnp4nagios