Nagios plug-in Pnp4nagios installation
Note: Nagios version nagios4.0.8
1. Download and install pnp4nagios-0.6.25.tar.gz
wget http://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.25.tar.gzyum-y Install RRDtool Perl-time-hires perl-file-tail rrdtool rrdtool-perl php-gdtar zxvf? PNP4NAGIOS-0.6.25.TAR.GZCD pnp4nagios-0.6.25
#perl-mrrds-le ' Print Q (ok!) '
If the return value is ok!, it can be Pnp4nagios configured and installed
#./configure--with-nagios-user=nagios--with-nagios-group=nagios--with-rrdtool=/usr/bin/rrdtool?--with-perl_lib _path=/usr/lib64/perl5/vendor_perl/auto/rrds
#make All
#make Install
#make install-webconf
#make Install-config
#make Install-init
2. Create a configuration file
CD/USR/LOCAL/PNP4NAGIOS/ETCMV misccommands.cfg-sample? MISCCOMMANDS.CFGMV nagios.cfg-sample? NAGIOS.CFGMV npcd.cfg-sample NPCD.CFGMV process_perfdata.cfg-sample? Process_perfdata.cfg
#?mv Rra.cfg-sample rra.cfg
#? CD pages
MV Web_traffic.cfg-sample WEB_TRAFFIC.CFGCD. /CHECK_COMMANDSMV check_all_local_disks.cfg-sample? CHECK_ALL_LOCAL_DISKS.CFGMV check_nrpe.cfg-sample? CHECK_NRPE.CFGMV check_nwstat.cfg-sample? Check_nwstat.cfg
- Restart Service/ETC/INIT.D/NPCD Restart
echo "/ETC/INIT.D/NPCD start" >>/etc/rc.local
4. Modify the Nagios configuration file. Open Performance_data
Cd/usr/local/nagios/etcvim nagios.cfg#打开注释项:
Process_performance_data=1
Host_perfdata_command=process-host-perfdata
Service_perfdata_command=process-service-perfdata
###################### #添加如下内容 ####################################
Service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
Service_perfdata_file_template=datatype::serviceperfdata\ttimet:: $TIMET $\thostname:: $HOSTNAME $\tservicedesc::$ Servicedesc$\tserviceperfdata:: $SERVICEPERFDATA $\tservicec::heckcommand:: $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 PerformanceData starting with Nagios 3.0Host_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
###########################################################
5. Modify Commands.cfg
Cd/usr/local/nagios/etc/objectsvim commands.cfg# #添加
#################################################################
Define Command{
Command_name Process-service-perfdata
command_line/usr/local/pnp4nagios/libexec/process_perfdata.pl--bulk=/usr/local/pnp4nagios/var/service-perfdata
}
Define Command{
Command_name Process-host-perfdata
command_line/usr/local/pnp4nagios/libexec/process_perfdata.pl--bulk=/usr/local/pnp4nagios/var/host-perfdata
}
- Add a small Sun template, set on the Nagios page. Vim Templates.cfg added at the end
Define host {
Name Host-pnp
action_url/pnp4nagios/graph?host= $HOSTNAME $&srv=host
Register 0
}
Define Service {
Name Srv-pnp
action_url/pnp4nagios/graph?host= $HOSTNAME $&srv= $SERVICEDESC $
Register 0
}
7, modify hosts.cfg and Services.cfg
Cd/usr/local/nagios/etc/objects#修改hosts. CFG
Vim Hosts.cfgDefine Host{
???????? Use???????????????????? Linux-server,host-pnp??
???????? HOST_NAME????????? Wwwserver
???????? Alias???????????????????? Wwwserver
???????? Address????????????????? 10.10.10.111
????????}
Modify Services.cfg
Define Service{
???????? Use???????????????????????? ? LOCAL-SERVICE,SRV-PNP??????
???????? HOST_NAME?????????????????? ? wwwserver
???????? Service_description???????? Ping
???????? Check_command???????????? check_ping!100.0,20%!500.0,60%
}
Other hosts and services, etc.
Check that the configuration file is correct or not
/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
Return values such as slices, restart Nagios
8. Restart? Nagios Service
#/etc/init.d/nagios restart
:
At this point, click on the small sun will appear as follows: The requested url/pnp4nagios/graph is not found on this server.
Here's how to fix it:
Cause, when you execute make install-webconf during Pnp4nagios installation, note that it generates an Apache configuration file.
You put this file:/etc/httpd/conf.d/pnp4nagios.conf? All content is added to Apache httpd.conf file Finally, and then reboot Nagios and Apache should be OK.
[Email protected] etc]# Find/-name pnp4nagios.conf
/etc/httpd/conf.d/pnp4nagios.conf
[Email protected] etc]# vim/etc/httpd/conf.d/pnp4nagios.conf
[Email protected] etc]# cat/etc/httpd/conf.d/pnp4nagios.conf>>/usr/local/apache/conf/httpd.conf
#service httpd Restart
#service Nagios Restart
Then click on the small Sun, will appear Pnp4nagios test page, the results are as follows:
Tell to erase or rename/usr/local/pnp4nagios/share/install.php
Fault 2:
Installation test:
http://monitor.dreamlive.tv//pnp4nagios/index.php
#cd/usr/local/pnp4nagios/share
#mv install.php Install.php.bak
In this test: The following is displayed:
No image appears, the main reason is:
Workaround:
Switch
Restart httpd
The result is normal.
Report the following error
Yum-y Install Pango Pango-devel
Then reboot the system.
Nagios plug-in Pnp4nagios installation