Naigos install pnp4nagios 绘图插件
原文地址:http://www.cnblogs.com/caoguo/p/5022230.html
[root@Cagios ~]# yum install -y rrdtool perl-rrdtool perl-Time-HiRes [root@Cagios src]# wget http://nchc.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.25.tar.gz[root@Cagios src]# tar zxf pnp4nagios-0.6.25.tar.gz [root@Cagios src]# cd pnp4nagios-0.6.25[root@Cagios pnp4nagios-0.6.25]# ./configure \--prefix=/usr/local/pnp4nagios --with-nagios-user=nagios --with-nagios-group=nagcmd [root@Cagios pnp4nagios-0.6.25]# make all [root@Cagios pnp4nagios-0.6.25]# make install [root@Cagios pnp4nagios-0.6.25]# make install-webconf [root@Cagios pnp4nagios-0.6.25]# make install-config # 开启日志文件 [root@Cagios ~]# vi /usr/local/pnp4nagios/etc/npcd.cfg log_type = file # 启动pnp4nagios服务 #[root@Cagios ~]# service npcd restart [root@Cagios ~]# /etc/init.d/npcd restart # 鼠标悬停图标显示文件 [root@Cagios pnp4nagios-0.6.25]# cp contrib/ssi/* /usr/local/nagios/share/ssi/ [root@Cagios ~]# chmod a+x /usr/local/nagios/share/ssi [root@Cagios ~]# chown -R nagios.nagcmd /usr/local/nagios/share/ssi [root@Cagios etc]# mv misccommands.cfg-sample misccommands.cfg [root@Cagios etc]# mv rra.cfg-sample rra.cfg [root@Cagios etc]# mv nagios.cfg-sample nagios.cfg [root@Cagios etc]# cd pages/ [root@Cagios pages]# mv web_traffic.cfg-sample web_traffic.cfg [root@Cagios pages]# cd ../check_commands/ [root@Cagios check_commands]# mv check_all_local_disks.cfg-sample check_all_local_disks.cfg [root@Cagios check_commands]# mv check_nrpe.cfg-sample check_nrpe.cfg [root@Cagios check_commands]# mv check_nwstat.cfg-sample check_nwstat.cfg # 编辑nagios配置文件 [root@Cagios ~]# vi /usr/local/nagios/etc/nagios.cfg 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::$SERVICECH ECKCOMMAND$\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$\tHOSTSTATE TYPE::$HOSTSTATETYPE$ host_perfdata_file_mode=a host_perfdata_file_processing_interval=15 host_perfdata_file_processing_command=process-host-perfdata-file [root@Cagios ~]# cd /usr/local/nagios/etc/objects/ [root@Cagios objects]# cp commands.cfg commands.cfg.old # 配置命令文件 # Bulk Mode with NPCD模式 [root@Cagios objects]# vi commands.cfg # 'process-host-perfdata' command definition #注释默认的process-host-perfdata和process-service-perfdata,添加以下 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$ } # 配置模板文件 [root@Cagios objects]# vi templates.cfg define host { name host-pnp action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_ register 0 process_perf_data 1 } define service { name service-pnp action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$ register 0 process_perf_data 1 } # 配置localhost主机文件,测试pnp4naigos [root@Cagios objects]# vi localhost.cfg define host{ use linux-server,host-pnp host_name localhost alias localhost address 127.0.0.1 } define service{ use local-service,service-pnp host_name localhost service_description PING check_command check_ping!100.0,20%!500.0,60% } define service{ use local-service,service-pnp host_name localhost service_description Root Partition check_command check_local_disk!20%!10%!/ } [root@Cagios ~]# cd /usr/local/pnp4nagios/share/ [root@Cagios share]# mv install.php install.php.bak [root@Cagios ~]# /etc/init.d/nagios restart [root@Cagios ~]# /etc/init.d/npcd restart