Install Nagios Core 4.3.2 in Debian Stretch Part 2

We already have a Nagios Core installed. Now we want to add some very nice add ons to the platform.

Download additional software

Go to Mathias Kettner web and download the last version of Check_MK.

wget -O /usr/src/check_mk-1.2.8p25.tar.gz

We also need Nagvis and PNP4Nagios

wget -O /usr/src/nagvis-1.9.2.tar.gz 
wget -O /usr/src/pnp4nagios-0.6.25.tar.gz



Install some dependencies for graphs.

apt-get install php7.0-gd librrds-perl rrdtool

Install PNP4Nagios.

Go to the folder where you’ve downloaded it (/usr/src), and extract it using command:

tar zxfv pnp4nagios-0.6.25.tar.gz
cd pnp4nagios-0.6.25/
./configure --with-httpd-conf=/etc/apache2/sites-enabled --sysconfdir=/usr/local/pnp4nagios --with-base-url=/site01/pnp4nagios
make all
make fullinstall

Edit Apache file /etc/apache2/sites-enabled/pnp4nagios.conf and set the correct PATH for AuthUserFile:

AuthUserFile /usr/local/nagios/etc/htpasswd.users

Now we have to restart Apache.

systemctl reload apache2

Check the configuration of PNP4Nagios:


“Your environment passed all requirements. Remove or rename the /usr/local/pnp4nagios/share/install.php file now.”

Remove the file file

rm /usr/local/pnp4nagios/share/install.php

Configuring PNP4Nagios.

PNP4Nagios allows a couples of integration ways with Nagios. We are going to use “Bulk-Mode”, since is the best way available for Nagios 4.
We need to copy this fragment to the bottom of the /usr/local/nagios/etc/nagios.cfg file (we have some examples inside /usr/local/pnp4nagios/ directory)

# Bulk / NPCD mode
# *** the template definition differs from the one in the original nagios.cfg
# *** the template definition differs from the one in the original nagios.cfg

We need to copy this fragment to the bottom of the /usr/local/nagios/etc/objects/misccommands.cfg file (we have some examples inside /usr/local/pnp4nagios/ directory)

# Bulk with NPCD mode
define command {
               command_name process-service-perfdata-file
               command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$

define command {
               command_name process-host-perfdata-file
               command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$

And add this line just after the cfg_dir block on /usr/local/nagios/etc/nagios.cfg file:


Set NPCD to start on boot.

systemctl enable npcd.service
systemctl start npcd.service
systemctl restart nagios.service

Now we can check again if everything is working:




Install some dependencies for graphs.

apt-get install libapache2-mod-python sudo

Install Check_MK

Note. To compile check_mk you should have at least 700Mb of RAM. If not, you may have an error like: g++: internal compiler error: Killed (program cc1plus)

cd /usr/src
tar zxfv check_mk-1.2.8p25.tar.gz
cd check_mk-1.2.8p25

We leave everything by default except this options.

Check_MK configuration
( default  --> /etc/check_mk): /usr/local/check_mk

Nagios command pipe
( default  --> /var/log/nagios/rw/nagios.cmd): /usr/local/nagios/var/rw/nagios.cmd

URL Prefix for Web addons
( default  --> /): /site01/

Apache config dir
( default  --> /etc/apache2/conf.d): /etc/apache2/sites-enabled

HTTP authentication file
( default  --> /etc/nagios/htpasswd.users): /usr/local/nagios/etc/htpasswd.users 

RRD files
( default  --> /var/lib/nagios/rrd): /usr/local/nagios/var/rrd

Unix socket for Livestatus
( previous --> /var/log/nagios/rw/live): /usr/local/nagios/var/rw/live
Install Event Console
( default  --> no): yes

Now we add CMK daemon on boot and restart all the services.

systemctl enable mkeventd
systemctl restart apache2
systemctl restart nagios
systemctl restart mkeventd

And check the web.




Install some dependencies for graphs.

apt-get install rsync php7.0-common libapache2-mod-php7.0 php7.0-cli php-gettext php7.0-cgi graphviz sqlite sqlite3 php7.0-sqlite libjson-xs-perl

Install Nagvis

cd /usr/src
tar xvzf nagvis-1.9.2.tar.gz
cd nagvis-1.9.2
./ -W /site01/nagvis -w /etc/apache2/sites-enabled

We leave all the option by default.
Once we finish the installation, we have to modify the Apache configuration file on /etc/apache2/conf-available/nagvis.conf and let it this way

<Directory "/usr/local/nagvis/share">
Require all granted
Options FollowSymLinks
AllowOverride None
#Order allow,deny
#Allow from all

Now we enable Nagvis configuration and restart Apache.

ln -s /etc/apache2/conf-available/nagvis.conf /etc/apache2/sites-enabled/nagvis.conf
systemctl restart apache2.service

And finally we can access to Nagvis: http://nagios-server-ip/site01/nagvis (admin / admin by default, we should change it on first login)
We will find a lot of graphs on it. To hace a fresh start we should delete them through the “Manage Map” menu.


Reference Links:

Print Friendly, PDF & Email

Pablo Javier Furnari

Linux System Administrator at La Plata Linux
I'm a Linux Sysadmin with 8 years of experience. I work with several clients as a consulter here in Argentina and oversea (I have clients in the United States, Mexico, Pakistan and Germany).

I know my strengths and weaknesses. I'm a quick learner, I know how to work with small and big teams. I'm hard worker, proactive and I achieve everything I propose.

Leave a Reply

Your email address will not be published. Required fields are marked *

Reload Image