Saturday , March 17 2018
Home / Network Admin / Installing PNP4Nagios for Nagios on CentOS

Installing PNP4Nagios for Nagios on CentOS

Print Friendly

In this tutorial, I’ll be installing PNP4Nagios for Nagios to draw graphs on Nagios NMS Server’s Web UI.

Download PNP4Nagios:

Installing Required Dependencies:

# yum -y install rrdtool rrdtool-perl php-gd perl-Time-HiRes libtool-ltdl rrdtool-devel php-rrdtool perl-rrdtool php php-pdo php-common


Extract & Install PNP4Nagios:

# cd /usr/local/src
# wget
# tar zxvf pnp4nagios-0.6.24.tar.gz
# cd pnp4nagios-0.6.24
# ./configure
# make all
# make fullinstall


Edit Nagios.cfg, enable “process_performance_data” and add following lines at last:

 #  vim /etc/nagios/nagios.cfg

# service performance data

# host performance data starting with Nagios 3.0

2- Edit Nagios Config File

Edit commands.cfg and add following lines at last:

# vim /etc/nagios/objects/commands.cfg
define command{
command_name process-service-perfdata-file
command_line /usr/local/pnp4nagios/libexec/ –bulk=/usr/local/pnp4nagios/var/service-perfdata

define command{
command_name process-host-perfdata-file
command_line /usr/local/pnp4nagios/libexec/ –bulk=/usr/local/pnp4nagios/var/host-perfdata


3- Edit Commands Config File


Edit “templates.cfg” and add following in Generic-host and Generic-service portions as:

# vim /etc/nagios/objects/templates.cfg
Add following line in “generic-host” portion:

action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_’ class=’tips’ rel=’/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_

Add following line in “generic-service” portion:

action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$’ class=’tips’ rel=’/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$


4- Edit Templates Config File


copy the file status-header.ssi from pnp4nagios package in /usr/local/src: < IT MUST NOT BE EXECUTEABLE…!!!>

# cp /usr/local/src/pnp4nagios-0.6.24/contrib/ssi/status-header.ssi /usr/local/nagios/share/ssi/


Edit PNP4nagios.conf file in HTTPD directory:

# vim /etc/httpd/conf.d/pnp4nagios.conf

And Set following value:

AuthUserFile /etc/nagios/htpasswd.users

5- Edit PnP4Nagios Config File


Restart Services:

# service httpd restart
# systemctl restart httpd.service
# service nagios restart
# service npcd start
# chkconfig npcd on

Now in Browser:::


6- Pnp4Nagios Test Pass
– If no error shown, remove or rename the file “install.php”

# mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/

7- Install File Rename

Now Restart Nagios, HTTPD and NPCD Services again, PNP4Nagios should now be showing graphs like:


8- Pnp4Nagios Graphs Working

7.5- Pnp4Nagios Working

About Muhammad Attique

Related Posts

Nagios Error: Can’t locate Time/ in @INC

Nagios is a great product for monitoring IT infrastructure. Since it is an open source …

  • rza

    Hi Muhmmad, thank you for this great job you’ve done here !!!

    I am a newbie in linux system, do you have others tutorial to define the services as the pictures in your tutorial ? like cpu, free space disk, ram, etc… with graph with pnp4Nagios

    thanks again

  • Hussain Gany

    Assalamu Alaikum Muhammad, Thanks for your wonderful article.

    I have successfully installed pnp4nagios but I have a small query. In nagios tool, I could find graph icon under services tab but the graph icon is showing under hosts tab..What would be the issue? Thanks in advance

  • Hussain Gany

    I have resolved the issue.

  • Lio

    Thank you.

    You just saved my job.