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
  • Pingback: Pnp4nagios data migration - convert RRD to XML GeekPeek.Net()

  • NANCY

    HOLA REALIZE ESTA INSTALACION PERO SOLICITA USER Y PASS QUE NO ES EL MISMO QUE EL DE LA INTERFAS NORMAL DE NAGIOS TIENES IDEA DE CUAL PODRIA SER

    • Mitch

      Hi Nancy! I would really like to answer your question but i don’t understand your language. Can you please translate your comment in English? Thanks, Mitch

  • Nancy

    ok. follow these instructions and asks me a username and password but not the same that I occupy at the interface htttp :/ / server / nagios

    • Mitch

      I don’t know how you have configured your nagios authentication and nagios apache virtual host. Usually if you are already logged in your nagios instance you shouldn’t be prompted for password when looking at pnp4nagios graphs (same username and password as nagios). Please check your nagios and pnp4nagios apache configuration file for additional information obout authentication. Regards, Mitch.

    • Francesco

      Hi, i had the same problem, just check the: /etc/httpd/conf.d/pnp4nagios.conf file .. it contains a wrong path pointing to the htpasswd file just edit it correctly and restart httpd. that’s it 🙂

      • Mitch

        Thanks for your input Francesco!

        Regards,
        Mitch

  • Pingback: Pnp4Nagios XML file not found Error - No Graphs | GeekPeek.Net()

  • Arie

    Hi Mitch,

    Does this work in a large installation too?

    • Mitch

      Hi Arie! Well i have it working without any problem on 150 hosts and 2000 services and 60 contacts configured. How large will your installation be? Regards, Mitch

      • Arie

        My installation consists of 550 hosts and currently 7600 services.
        Configuration is done with check_mk.

        • Mitch

          Well works for me without any glitch – you should be ok too. Try it out and let me know 😉 regards, Mitch

          • Arie

            It is not working for me, i have this error: http://tracker.nagios.org/view.php?id=534 and no perfdata is handled.
            I am returning to bluk mode now, cause that works, but needs some tuning with core 4

  • pkutty

    dear Mitch
    I tried your installtion step in fully automated nagios but Its not working in Fully automated nagios paths were different
    nagios.cfg and commands.cfg where in /etc/nagios/nagios.cfg and /etc/nagios/objects/commands.cfg .I edit your scrip with correct path . I got the error message CONFIG ERROR! Restart aborted. Check your Nagios configuration. what should I do ..
    I am wandering for a solution for this

  • Robert

    There are crucial steps missing. like the call to the pnp4nagios url