Performance Data in Icinga Web 2 (Update)


  • You have a running Icinga2 plus IcingaWeb2 and want to work with the recorded performance data.
  • You want use PNP4Nagios but the installation is a pain in the ass.

If you follow the instructions you will hopefully getting something like this:


  • Installed Icinga2
  • Configured hosts and services
  • Ubuntu Server 14.04.3



~$ sudo apt-get update && sudo apt-get upgrade
~$ sudo apt-get install --no-install-recommends pnp4nagios rrdcached libapache2-mod-wsgi
~$ sudo icinga2 feature enable perfdata

PNP4Nagios Configuration

This will be the worst part of it.
Edit /etc/pnp4nagios/npcd.cfg:

#perfdata_spool_dir = /var/spool/pnp4nagios/npcd/
perfdata_spool_dir = /var/spool/icinga2/perfdata

npcd daemon
Then, the npcd daemon needs to be configured. Edit /etc/default/npcd and change run to yes:


Restart the service:

~$ sudo service npcd start

rrdcached configuration

~$ sudo mkdir -p /var/cache/rrdcached
~$ sudo chown nagios: /var/cache/rrdcached

Edit /etc/default/rrdcached to add a new line:

OPTS="-w 1800 -z 1800 -j /var/cache/rrdcached -s nagios -m 0660 -l unix:/var/run/rrdcached.sock"

Put www-data in the nagios group

~$ sudo usermod -G nagios www-data

Edit the file /etc/pnp4nagios/config.php:

#$conf['nagios_base'] = "/cgi-bin/nagios3";
$conf['nagios_base'] = "/cgi-bin/icinga";
#$conf['RRD_DAEMON_OPTS'] = '';
$conf['RRD_DAEMON_OPTS'] = 'unix:/var/run/rrdcached.sock';

Edit /etc/pnp4nagios/process_perfdata.cfg and change RRD_DAEMON_OPTS:

RRD_DAEMON_OPTS = unix:/var/run/rrdcached.sock

Apache Configuration

cp /etc/pnp4nagios/apache.conf /etc/apache2/conf-available/pnp4nagios.conf

The default PNP4Nagios requires a htaccess file. Because IcingaWeb2 does not have one i deleted the login/password requirement in the configuration. If you want to use this in a real setup, you have to provide a valid htaccess.
Edit /etc/apache2/conf-available/pnp4nagios.conf and comment these lines:

# AuthType Basic
# AuthUserFile /etc/nagios3/htpasswd.users
# Require valid-user

Load config:

a2enconf pnp4nagios
service apache2 reload

Icinga2 Configuration (Update)

Update: You do not need to follow the instructions in this section. The PNP Module (see next section) will do the work for you.

To enable PNP4Nagios for your services and host you have to provide actions for every entity. To do this you simply add two new templates and import them in the host and the service template.
Edit /etc/icinga2/conf.d/templates.conf:

template Host “pnp-hst” {
action_url = “/pnp4nagios/graph?host=$HOSTNAME$’ class=’tips’ rel=’/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_”

template Service “pnp-svc” {
action_url = “/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$’ class=’tips’ rel=’/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$”

Import the templates in /etc/icinga2/conf.d/templates.conf:

template Host “generic-host” {
import “pnp-hst”

template Service “generic-service” {
import “pnp-svc”

IcingaWeb2 Configuration

Download module for PNP4Nagios:


Unzip it in /usr/share/icingaweb2/modules/
Fixing permissions

~$ sudo usermod -a -G icingacmd www-data
~$ sudo usermod -a -G icingaweb2 www-data

Restart Everything

~$ sudo service rrdcached restart
~$ sudo service npcd restart
~$ sudo service apache2 restart
~$ sudo service icinga2 reload
~$ sudo service icinga2 restart

Enable Module

In the last step you have to enable the pnp4nagios module:
Enable PNP4Nagios in IcingaWeb2



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s