nagios插件pnp4 (nagios绘图)

pnp4nagios一个基于php和perl,用rrdtool将nagios采集的数据绘制图表的工具,以可视化图形的方式呈现给用户的一款nagios插件


1. yum install rrdtoll  gd  gd-devel php-gd
2. yum install perl-Time-HiRes
3. wget http://downloads.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.21.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpnp4nagios%2Ffiles%2FPNP-0.6%2F&ts=1373249605&use_mirror=jaist


4. tar -zvxf pnp4nagios-0.6.21.tar.gz 


5. cd pnp4nagios-0.6.21


6. ./configure 


7. make all 
make install 
make install-config 
make install-init
make install-webconf


安装目录:  /usr/local/pnp4nagios


8.
cd   /usr/local/pnp4nagios/etc 
mv misccommands.cfg-sample  misccommands.cfg 
mv nagios.cfg-sample nagios.cfg 
mv rra.cfg-sample rra.cfg
cd /usr/local/pnp4nagios/etc/pages/ 
mv web_traffic.cfg-sample web_traffic.cfg
cd ../check_commands 
mv check_all_local_disks.cfg-sample  check_all_local_disks.cfg 
mv check_nrpe.cfg-sample  check_nrpe.cfg 
mv check_nwstat.cfg-sample  check_nwstat.cfg 




9. 重启服务
service npcd restart




10. 修改 nagios 的配置文件: 打开performance_data
cd /etc/nagios
vim nagios.cfg


process_performance_data=1 
#将此变量值设为1 
host_perfdata_command=process-host-perfdata 
service_perfdata_command=process-service-perfdata 
#取消这两项的注释 






11. 修改 commands.cfg
cd /etc/nagios/objects
vim commands.cfg 


# 'process-host-perfdata' command definition 
define command{ 
       command_name   process-host-perfdata 
       command_line   /usr/local/pnp4nagios/libexec/process_perfdata.pl 
       } 
# 'process-service-perfdata' command definition 
define command{ 
       command_name   process-service-perfdata 
       command_line   /usr/local/pnp4nagios/libexec/process_perfdata.pl 
       } 
#添加上面两行在文件的末行 ,并删除或注释掉原有对process-host-perfdata和process-service-perfdata进行定义的字段 






12.添加小太阳模版,镶嵌在nagios页面上。
cd /etc/nagios/objects
vim templates.cfg
## 在最后添加
define host { 
name          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 { 
name         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 



#回到解压目录下,复制鼠标悬停图标显示,预览绘图所需的文件到nagios html目录
mkdir /usr/share/nagios/html/ssi/
cp ../pnp4nagios-0.6.14/contrib/ssi/*  /usr/share/nagios/html/ssi/


13. 检测配置文件语法
nagios -v /etc/nagios/nagios.cfg 




14. 重启服务
service nagios restart 

你可能感兴趣的:(用户)