DevOps - Lab 9: Installing and Configuring PNP4Nagios
Installing and Configuring PNP4Nagios
In Lab 9: Installing and Configuring PNP4Nagios, participants typically focus on extending the monitoring capabilities of Nagios by installing and configuring the PNP4Nagios plugin. PNP4Nagios is designed to enhance Nagios with performance data visualization and graphing capabilities. This lab involves the installation of PNP4Nagios components, configuration of the Nagios integration, and exploration of the web interface for graphing and analyzing performance metrics. Participants may also learn to customize and fine-tune graphing options to meet specific monitoring requirements. The lab aims to provide hands-on experience in extending Nagios functionalities, enabling participants to visualize and analyze performance data effectively. Successful completion of Lab 9 equips participants with the skills to enhance their Nagios monitoring setup with advanced graphing capabilities using PNP4Nagios.
Lab:
Step 1: installing and configuring PNP4Nagios
yum install rrdtool
yum install ruby xorg-x11-fonts-Type1 php-xml
Step 2: Downloading PNP4Nagios
cd /tmp/
wget https://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.25.tar.gz
tar -xvf pnp4nagios-0.6.25.tar.gz
cd pnp4nagios-0.6.25
./configure --with-rrdtool=/usr/bin/rrdtool --with-nagios-user=nagios --with-nagios-group=nagcmd
make all
make install-webconf
make install-config
make install-init
make fullinstall
Step 3: Start and Enable web & nagios service
systemctl enable npcd
systemctl start npcd
systemctl restart nagios
systemctl restart httpd
Step 4: Verify PNP4Nagios configuration
cd scripts
./verify\_pnp\_config\_v2.pl -m bulk -c /usr/local/nagios/etc/nagios.cfg -p /usr/local/pnp4nagios/etc/
Step 5: Edit vi /usr/local/nagios/etc/nagios.cfg
file add add below lines at the end
\# service performance data
#
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
#
# host performance data starting with Nagios 3.0
#
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\`
Step 6: Change below value from 0 to 1
process\_performance\_data=1
enable\_environment\_macros=1
Step 7: Error 1 – [CRIT] Command process-service-perfdata-file is not defined
vi /usr/local/nagios/etc/objects/commands.cfg
define command{
command\_name process-service-perfdata-file
command\_line /usr/local/pnp4nagios/libexec/process\_perfdata.pl --bulk=/usr/local/pnp4nagios/var/service-perfdata
}
define command{
command\_name process-host-perfdata-file
command\_line /usr/local/pnp4nagios/libexec/process\_perfdata.pl --bulk=/usr/local/pnp4nagios/var/host-perfdata
}
yum install php-xml
Step 8: Error 2 – sizeof(): Parameter must be an array or an object that implements Countable
vi /usr/local/pnp4nagios/share/application/models/data.php
Default line number: 979
Change from
if(sizeof($pages) > 0 ){
To
/\*if(sizeof($pages) > 0 ){\*/
if(is\_array($pages)&&sizeof($pages) > 0){
systemctl restart httpd
systemctl restart nagios
Step 9: Error 3
Deprecated Methods v/ith the same name as the r class «ni not De constructors in a future version of PHP Servlces_JSON has a deprecated constructor ‘usr local pnp4nagios share applications ison.php on line 115 Deprecated Methods with the same name as the« class nH not be constructors in a future version of PHP Services_JSON_Error has a deprecated constructor in ‘usr>local’pnp4nagios>’share application/lib json.php on line 781 Deprecated Methods with the same name as the« class w not be constructors in a future version of PHP Services_JSON_Errot has a deprecated constructor in ‘usr’local’pnp4nagios’Share application/lib json.php on line 795
vi /usr/local/pnp4nagios/share/application/lib/json.php
From
class Services\_JSON
To
class \_Services\_JSON
From
class Services\_JSON\_Error extends PEAR\_Error
To
class \_Services\_JSON\_Error extends PEAR\_Error
From
class Services\_JSON\_Error
To
class \_Services\_JSON\_Error
rm -rf /usr/local/pnp4nagios/share/install.php
Step 10: Define a service to “ping” the local machine
vi /usr/local/nagios/etc/objects/localhost.cfg
define service {
use local-service ; Name of service template to use
host\_name localhost
service\_description PING
check\_command check\_ping!100.0,20%!500.0,60%
action\_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
}
systemctl restart httpd
systemctl restart nagios