PNP4NAGIOS:-
Pnp4Nagios plant alongside Nagios to generate the graph of services that are beingness monitored yesteryear Nagios server. With the handle of Pnp4Nagios, nosotros tin meet the graph anytime whenever needed, It tape graph for all the configured services, We tin sentiment usage similar CPU, RAM, Disk Space etc.
Prerequisites:
1- RRDTOOL, rrdtool-perl
2- Perl
3- Php-gd
4- perl-time-HiRes
Step 1- Installation
To Install prerequisites run below command
[root@localhost ]# yum install rrdtool perl-Time-HiRes rrdtool-perl php-gd
Once prerequisites installation done, download pnp4nagios.
Step 2- Download PNP4Nagios, Extract in addition to Install
[root@localhost ]# wget https://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.25.tar.gz
Once download transcend finished, extract packet using ascendancy below
[root@localhost ]# tar zxfv pnp4nagios-0.6.25.tar.gz
Go to the Extracted directory in addition to configure it.
[root@localhost ]# cd pnp4nagios-0.6.25
Configure pnp4nagios in addition to install using ascendancy below
[root@localhost pnp4nagios]# ./configure [root@localhost pnp4nagios]# brand all [root@localhost pnp4nagios]# brand fullinstall
Enable NPCD service to starting fourth dimension at kick fourth dimension in addition to starting fourth dimension it now.
[root@localhost ]# chkconfig --add npcd && chkconfig --level 35 npcd on
Let's reboot httpd service.
[root@localhost ]# systemctl restart httpd
Step 2- Let's depository fiscal establishment lucifer PNP4Nagios installation.
Open browser in addition to type URL:- 192.168.102.11/pnp4nagios/
After successful PNP4Nagios installation, you lot volition transcend the window similar above.
Step 3- Let's rename install.php to install.php-bak
[root@localhost ]# mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php-bak
Step 4- Make the required changes inward Nagios configuration to integrate PNP4Nagios to generate graph.
Make the changes inward nagios.cfg configuration file.
[root@localhost ]# vi /usr/local/nagios/etc/nagios.cfg
Change the Process_performance_data=1 in addition to append below mentions line.
# Bulk / NPCD mode process_performance_data=1 service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECH$ service_perfdata_file_mode=a service_perfdata_file_processing_interval=15 service_perfdata_file_processing_command=process-service-perfdata-file host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$ host_perfdata_file_mode=a host_perfdata_file_processing_interval=15 host_perfdata_file_processing_command=process-host-perfdata-file
Save in addition to leave of absence from file.
Now brand the required changes inward command.cfg file
[root@localhost ]# vi /usr/local/nagios/etc/objects/commands.cfg
Go to the terminate of file in addition to append the crimson business below in addition to comment all the dark line.
# 'process-host-perfdata' ascendancy Definition #define command{ # command_name process-host-perfdata # command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out # } # 'process-service-perfdata' ascendancy Definition #define command{ # command_name process-service-perfdata # command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out # } # 'process-host-perfdata' ascendancy Definition define command{ command_name process-host-perfdata command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$$ } # 'process-service-perfdata' ascendancy Definition define command{ command_name process-service-perfdata command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$$ } 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$ }
Let's brand alter inward template.cfg file
[root@localhost ]# vi /usr/local/nagios/etc/objects/templates.cfg
Append the crimson business inward the below of file.
# PNP4NAGIOS # define host { hollo host-pnp action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_ register 0 } define service { hollo srv-pnp action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ register 0
Save in addition to Exit from file
Now brand the alter inward the host configuration fiel
[root@localhost ]# vi /usr/local/nagios/etc/objects/localhost.cfg
Append the next lines inward the terminate of file.
# Define a host for the local machine define host{ purpose linux-server,host-pnp ; Name of host template to purpose ; This host Definition volition inherit all variables that are defined ; inward (or inherited by) the linux-server host template definition. host_name localhost alias localhost address 127.0.0.1 }
# Define a service to "ping" the local machine define service{ purpose local-service,srv-pnp ; Name of service template to use host_name localhost service_description PING check_command check_ping!100.0,20%!500.0,60% }
Save in addition to leave of absence from file.
All the configuration changed completed successfully.
Step 5- Now restart httpd, Nagios in addition to Npcd service using ascendancy below.
[root@localhost ]# systemctl restart httpd && systemctl restart nagios && systemctl restart npcd
Step 6- Verify integration of PNP4Nagios
Open Nagios server URL:- http://192.168.102.11/nagios/
After successful integration of PNP4nagios you lot transcend a graph symbol for each service similar inward below image:
And you lot volition meet graph for private service icon similar below: