nagios安装配置pnp4nagios-0.6.6

标签:nagios职场休闲pnp

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。 http://deidara.blog.51cto.com/400447/382129

nagios 安装完了,只有数字输出监控内容是不是不炫丽呢?是不是想像CACTI 一样出炫丽的图呢?那你可以选择PNP,他可以满足你的需求,只要你的脚本符合perfdata规则,那么rrdtool就可以出数据,PNP就可以用图给你画出来。

1.下载安装 pnp4nagios-0.6.6.tar.gz

nagios $> wget http://cdnetworks-kr-1.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.6.tar.gznagios $> apt-get install rrdtool librrds-perlnagios $> tar zxvf  pnp4nagios-0.6.6.tar.gznagios $> cd pnp4nagios-0.6.6nagios $> ./configure --with-nagios-user=nagios --with-nagios-group=nagcmdnagios $> make allnagios $> make installnagios $> make install-webconfnagios $> make install-confignagios $> make install-init

2.创建配置文件

nagios $> cd /usr/local/pnp4nagios/etcnagios $> mv misccommands.cfg-sample  misccommands.cfgnagios $> mv nagios.cfg-sample  nagios.cfgnagios $> mv npcd.cfg-sample npcd.cfgnagios $> mv process_perfdata.cfg-sample  process_perfdata.cfgnagios $> mv rra.cfg-sample rra.cfgnagios $>  cd pagesnagios $> mv web_traffic.cfg-sample web_traffic.cfgnagios $> cd ../check_commandsnagios $> mv check_all_local_disks.cfg-sample  check_all_local_disks.cfgnagios $> mv check_nrpe.cfg-sample  check_nrpe.cfgnagios $> mv check_nwstat.cfg-sample  check_nwstat.cfg

3. 重启服务

nagios $> /etc/init.d/npcd restart

4.修改 nagios 的配置文件.打开performance_data

nagios $> cd /usr/local/nagios/etcnagios $> vim nagios.cfg#打开注视项:process_performance_data=1host_perfdata_command=process-host-perfdataservice_perfdata_command=process-service-perfdata

5.修改 commands.cfg

nagios $> cd /usr/local/nagios/etc/objectsnagios $> vim commands.cfg##添加# 'process-host-perfdata' command definitiondefine command{        command_name    process-host-perfdata        command_line    /usr/local/pnp4nagios/libexec/process_perfdata.pl        }# 'process-service-perfdata' command definitiondefine command{        command_name    process-service-perfdata        command_line    /usr/local/pnp4nagios/libexec/process_perfdata.pl        }

6. 添加小太阳模版,镶嵌在nagios页面上。

nagios $> vim templates.cfg## 在最后添加define host {name       host-pnpaction_url /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_register   0}define service {name       srv-pnpaction_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$register   0}

7,修改 hosts.cfg 和  色services.cfg

nagios $> cd /usr/local/nagios/etc/eric.com#修改hosts.cfgnagios $> vim hosts.cfgdefine host{        use                     linux-server,host-pnp          host_name         eric.com        alias                     eric.com        address                 192.168.6.101        }# 修改 services.cfgdefine service{        use                                     local-service,srv-pnp              host_name                       eric.com        service_description        PING        check_command            check_ping!100.0,20%!500.0,60%}

8.重启 nagios 服务

nagios $> /etc/init.d/nagios restart

效果图:
pnp图


你可能感兴趣的:(pnp4nagios)