Share, , Google Plus, Pinterest,

Print

Posted in:

Pnp4Nagios CentOS install

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). It analyzes performance data provided by Nagios and stores them in RRD-databases. RRD Tool enables you to view performance and availability graphs for your Nagios services or hosts.

PNP4Nagios Broker Module npcdmod.o is not compatible with Nagios Core 4.x!

Pnp4nagios graph
Pnp4nagios graph

Let’s start our Pnp4Nagios install on CentOS Guide!

1. Download Pnp4Nagios

Download latest tar from http://www.pnp4nagios.org/ and transfer it to your server.

2. Extract tar package

[root@foo ~]# tar -xvzf pnp4nagios-VERSION.tar.gz

3. Install dependencies

[root@foo ~]# yum install rrdtool rrdtool-perl -y

4. Configure

[root@foo ~]# cd pnp4nagios-VERSION
[root@foo ~]# ./configure

5. Make

[root@foo ~]# make all
[root@foo ~]# make fullinstall

After making full install the output should look something like this…

*** Configuration summary for pnp4nagios-0.6.21 03-24-2013 ***
General Options:
-------------------------         -------------------
Nagios user/group:                nagios nagios
Install directory:                /usr/local/pnp4nagios
HTML Dir:                         /usr/local/pnp4nagios/share
Config Dir:                       /usr/local/pnp4nagios/etc
Location of rrdtool binary:       /usr/bin/rrdtool Version 1.3.8
RRDs Perl Modules:                FOUND (Version 1.3008)
RRD Files stored in:              /usr/local/pnp4nagios/var/perfdata
Logfile:      /usr/local/pnp4nagios/var/perfdata.log
Perfdata files (NPCD) stored in:  /usr/local/pnp4nagios/var/spool
Web Interface Options:
-------------------------         -------------------
HTML URL:                         http://localhost/pnp4nagios
Apache Config File:               /etc/httpd/conf.d/pnp4nagios.conf

6. Move install.php

Rename install.php script and link it to /var/www/html.

[root@foo ~]# mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.ignore
[root@foo ~]# ln -s /usr/local/pnp4nagios/ /var/www/html/pnp4nagios

8. Edit nagios.cfg

Edit nagios.cfg and commands.cfg and rewrite as follows.

nagios.cfg

# HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS
# These commands are run after every host and service check is
# performed.  These commands are executed only if the
# enable_performance_data option (above) is set to 1.  The command
# argument is the short name of a command definition that you
# define in your host configuration file.  Read the HTML docs for
# more information on performance data.
#host_perfdata_command=process-host-perfdata
#service_perfdata_command=process-service-perfdata
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

commands.cfg

################################################################################
#
# SAMPLE PERFORMANCE DATA COMMANDS
#
# These are sample performance data commands that can be used to send performance
# data output to two text files (one for hosts, another for services).  If you
# plan on simply writing performance data out to a file, consider using the
# host_perfdata_file and service_perfdata_file options in the main config file.
#
################################################################################
# 'process-host-perfdata' command definition
#define command{
#        command_name    process-host-perfdata
#        command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$t$HOSTNAME$t$HOSTSTATE$t$HOSTATTEMPT$t$HOSTSTATETYPE$t$HOSTEXECUTIONTIME$t$HOSTOUTPUT$t$HOSTPERFDATA$n" >> /usr/local/nagios/var/host-perfdata.out #       }
# 'process-service-perfdata' command definition
#define command{
#        command_name    process-service-perfdata
#        command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$t$HOSTNAME$t$SERVICEDESC$t$SERVICESTATE$t$SERVICEATTEMPT$t$SERVICESTATETYPE$t$SERVICEEXECUTIONTIME$t$SERVICELATENCY$t$SERVICEOUTPUT$t$SERVICEPERFDATA$n" >> /usr/local/nagios/var/service-perfdata.out
#        }
define command {
command_name    process-service-perfdata
command_line    /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name    process-host-perfdata
command_line    /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}

9. Restart services

Restart Apache and Nagios service wait 5 minutes and enjoy your Nagios graphs!

[root@foo ~]# /etc/init.d/httpd restart
[root@foo ~]# /etc/init.d/nagios restart