Install Nagios Core 4.1.1 in Debian Jessie 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.6p16.tar.gz http://mathias-kettner.com/download/check_mk-1.2.6p16.tar.gz

We also need Nagvis and PNP4Nagios

wget -O /usr/src/nagvis-1.8.5.tar.gz http://www.nagvis.org/share/nagvis-1.8.5.tar.gz 
wget -O /usr/src/pnp4nagios-0.6.25.tar.gz  http://downloads.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.25.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fpnp4nagios%2Ffiles%2FPNP-0.6%2F&ts=1460394997&use_mirror=pilotfiber

PNP4Nagios

Prerequisites


Install some dependencies for graphs.

apt-get install php5-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:

http://nagios-server-ip/site01/pnp4nagios/

Imagen25

“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
#
process_performance_data=1
# *** the template definition differs from the one in the original nagios.cfg
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# *** the template definition differs from the one in the original nagios.cfg
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file

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:

cfg_file=/usr/local/nagios/etc/objects/misccommands.cfg

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:

http://nagios-server-ip/site01/pnp4nagios/

Check_MK

Prerequisites

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.6p16.tar.gz
cd check_mk-1.2.6p16
./setup.sh

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

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.

http://nagios-server-ip/site01/check_mk/

Nagvis

Prerequisites

Install some dependencies for graphs.

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

Install Nagvis

cd /usr/src
tar xvzf nagvis-1.8.5.tar.gz
cd nagvis-1.8.5
./install.sh -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.

Imagen26

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.

3 thoughts on “Install Nagios Core 4.1.1 in Debian Jessie Part 2

Leave a Reply

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


CAPTCHA Image
Reload Image