参考
1. http://www.aboutmonitoring.com/nagios4-check_mk-pnp4nagios-nagvis/
2. http://blog.csdn.net/TCH8502/article/details/22151525
3. https://docs.pnp4nagios.org/pnp-0.6/verify_pnp_config
4. http://blog.chinaunix.net/uid-261392-id-2138990.html
5. 官方文档 https://docs.pnp4nagios.org/pnp-0.6/start (重要)
需要 rrtool 支持
yum install rrdtool gd gd-devel php-gd
(1)安装
#tar -zxvf php4nagios-*.tar.gz
#cd php4nagios
#./configure –with-nagios-user=nagios –with-nagios-group=nagios (如果单独编译安装的rrdtoool,则使用–with-rrdtool=/usr/local/rrdtool-1.2.xx/bin/rrdtool这样的形式)
#make all
#make install
#make install-webconf
#make install-config
#make install-init
#make fullinstall
(使用这条命令替换所有的make命令, make fullinstall)
#service httpd restart
process_performance_data=0为
process_performance_data=1
#
# 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
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$
}
/usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg
systemctl restart nagios
ls -la /usr/local/pnp4nagios/var/service-perfdata
wget http://verify.pnp4nagios.org/verify_pnp_config
perl /home/nagios/verify_pnp_config --mode bulk+npcd --config=/usr/local/nagios/etc/nagios.cfg --pnpcfg=/usr/local/pnp4nagios/etc 输出内容: [root@nagios_server objects]# perl /home/nagios/verify_pnp_config --mode bulk+npcd --config=/usr/local/nagios/etc/nagios.cfg --pnpcfg=/usr/local/pnp4nagios/etc [INFO] ========== Starting Environment Checks ============ [INFO] My version is: verify_pnp_config-0.6.25-R.40 [INFO] Start Options: /home/nagios/verify_pnp_config --mode bulk+npcd --config=/usr/local/nagios/etc/nagios.cfg --pnpcfg=/usr/local/pnp4nagios/etc [INFO] Reading /usr/local/nagios/etc/nagios.cfg [OK ] Running product is 'nagios' [OK ] object_cache_file is defined [OK ] object_cache_file=/usr/local/nagios/var/objects.cache [INFO] Reading /usr/local/nagios/var/objects.cache [OK ] resource_file is defined [OK ] resource_file=/usr/local/nagios/etc/resource.cfg [INFO] Reading /usr/local/nagios/etc/resource.cfg [INFO] Reading /usr/local/pnp4nagios/etc/process_perfdata.cfg [INFO] Reading /usr/local/pnp4nagios/etc/pnp4nagios_release [OK ] Found PNP4Nagios version "0.6.25" [OK ] ./configure Options '--with-nagios-user=nagios' '--with-nagios-group=nagios' [OK ] Effective User is 'nagios' [OK ] User nagios exists with ID '1001' [OK ] Effective group is 'nagios' [OK ] Group nagios exists with ID '1001' [INFO] ========== Checking Bulk Mode + NPCD Config ============ [OK ] process_performance_data is 1 compared with '/1/' [OK ] service_perfdata_file is defined [OK ] service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata [OK ] service_perfdata_file_template is defined [OK ] service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$ [OK ] PERFDATA template looks good [OK ] service_perfdata_file_mode is defined [OK ] service_perfdata_file_mode=a [OK ] service_perfdata_file_processing_interval is defined [OK ] service_perfdata_file_processing_interval=15 [OK ] service_perfdata_file_processing_command is defined [OK ] service_perfdata_file_processing_command=process-service-perfdata-file [OK ] host_perfdata_file is defined [OK ] host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata [OK ] host_perfdata_file_template is defined [OK ] host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$ [OK ] PERFDATA template looks good [OK ] host_perfdata_file_mode is defined [OK ] host_perfdata_file_mode=a [OK ] host_perfdata_file_processing_interval is defined [OK ] host_perfdata_file_processing_interval=15 [OK ] host_perfdata_file_processing_command is defined [OK ] host_perfdata_file_processing_command=process-host-perfdata-file [INFO] Nagios config looks good so far [INFO] ========== Checking config values ============ [OK ] npcd daemon is running [OK ] /usr/local/pnp4nagios/etc/npcd.cfg is used by npcd and readable [INFO] Reading /usr/local/pnp4nagios/etc/npcd.cfg [OK ] perfdata_spool_dir is defined [OK ] perfdata_spool_dir=/usr/local/pnp4nagios/var/spool [OK ] 1 files found in /usr/local/pnp4nagios/var/spool service_perfdata_file_processing_command at /home/nagios/verify_pnp_config line 462. [OK ] Command process-service-perfdata-file is defined [OK ] '/bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$' [OK ] Command looks good host_perfdata_file_processing_command at /home/nagios/verify_pnp_config line 462. [OK ] Command process-host-perfdata-file is defined [OK ] '/bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$' [OK ] Command looks good [OK ] Script /usr/local/pnp4nagios/libexec/process_perfdata.pl is executable [INFO] ========== Starting global checks ============ [OK ] status_file is defined [OK ] status_file=/usr/local/nagios/var/status.dat [INFO] host_query = [INFO] service_query = [INFO] Reading /usr/local/nagios/var/status.dat [INFO] ==== Starting rrdtool checks ==== [OK ] RRDTOOL is defined [OK ] RRDTOOL=/bin/rrdtool [OK ] /bin/rrdtool is executable [OK ] RRDtool 1.4.8 Copyright 1997-2013 by Tobias Oetiker <[email protected]> [OK ] USE_RRDs is defined [OK ] USE_RRDs=1 [OK ] Perl RRDs modules are loadable [INFO] ==== Starting directory checks ==== [OK ] RRDPATH is defined [OK ] RRDPATH=/usr/local/pnp4nagios/var/perfdata [OK ] Perfdata directory '/usr/local/pnp4nagios/var/perfdata' exists [WARN] 2 hosts/services are not providing performance data [WARN] 'process_perf_data 1' is set for 3 hosts/services which are not providing performance data! [OK ] 'process_perf_data 1' is set for 77 of your hosts/services [INFO] ==== System sizing ==== [OK ] 76 hosts/service objects defined [INFO] ==== Check statistics ==== [WARN] Warning: 2, Critical: 0 [WARN] Checks finished...
define host{ name host-pnp register 0 action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_ }
例如:vim /usr/local/nagios/etc/objects/oa_server.cfg
define host{ use windows-server,host-pnp; Inherit default values from a template, host-pnp 就是调用在templates.cfg 中定于的显示图像的功能 ... }
pnp4nagios4.10版本apache至此不需要做任何配置,直接就可以访问了,升级到0.6后发现必须rewrite了
安装pnp4nagios 时使用make install-webconf
这个会在/etc/httpd/ conf.d/中生成pnp4nagios.conf文件将其引入到/usr/local/apach2/conf/http.conf文件中
# 使用 pnp4nagios Include /etc/httpd/conf.d/pnp4nagios.conf