Naigos install pnp4nagios 绘图插件 原文地址:http://www.cnblogs.com/caoguo/p/5022230.html
[[email protected] ~]# yum install -y rrdtool perl-rrdtool perl-Time-HiRes [[email protected] src]# wget http://nchc.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.25.tar.gz [[email protected] src]# tar zxf pnp4nagios-0.6.25.tar.gz [[email protected] src]# cd pnp4nagios-0.6.25 [[email protected] pnp4nagios-0.6.25]# ./configure --prefix=/usr/local/pnp4nagios --with-nagios-user=nagios --with-nagios-group=nagcmd [[email protected] pnp4nagios-0.6.25]# make all [[email protected] pnp4nagios-0.6.25]# make install [[email protected] pnp4nagios-0.6.25]# make install-webconf [[email protected] pnp4nagios-0.6.25]# make install-config # 开启日志文件 [[email protected] ~]# vi /usr/local/pnp4nagios/etc/npcd.cfg log_type = file # 启动pnp4nagios服务 #[[email protected] ~]# service npcd restart [[email protected] ~]# /etc/init.d/npcd restart # 鼠标悬停图标显示文件 [[email protected] pnp4nagios-0.6.25]# cp contrib/ssi/* /usr/local/nagios/share/ssi/ [[email protected] ~]# chmod a+x /usr/local/nagios/share/ssi [[email protected] ~]# chown -R nagios.nagcmd /usr/local/nagios/share/ssi [[email protected] etc]# mv misccommands.cfg-sample misccommands.cfg [[email protected] etc]# mv rra.cfg-sample rra.cfg [[email protected] etc]# mv nagios.cfg-sample nagios.cfg [[email protected] etc]# cd pages/ [[email protected] pages]# mv web_traffic.cfg-sample web_traffic.cfg [[email protected] pages]# cd ../check_commands/ [[email protected] check_commands]# mv check_all_local_disks.cfg-sample check_all_local_disks.cfg [[email protected] check_commands]# mv check_nrpe.cfg-sample check_nrpe.cfg [[email protected] check_commands]# mv check_nwstat.cfg-sample check_nwstat.cfg # 编辑nagios配置文件 [[email protected] ~]# 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 [[email protected] ~]# cd /usr/local/nagios/etc/objects/ [[email protected] objects]# cp commands.cfg commands.cfg.old # 配置命令文件 # Bulk Mode with NPCD模式 [[email protected] 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$ } # 配置模板文件 [[email protected] 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 [[email protected] 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%!/ } [[email protected] ~]# cd /usr/local/pnp4nagios/share/ [[email protected] share]# mv install.php install.php.bak [[email protected] ~]# /etc/init.d/nagios restart [[email protected] ~]# /etc/init.d/npcd restart
时间: 2024-10-26 06:19:44