nagios图像(pnp)
http://down.51cto.com/data/281835
http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rrdtool-1.2.18-1.el5.rf.i386.rpm (32位)
http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-rrdtool-1.2.18-1.el5.rf.i386.rpm
http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rrdtool-1.2.18-1.el5.rf.x86_64.rpm (64位)
http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/perl-rrdtool-1.2.18-1.el5.rf.x86_64.rpm
# rpm -ivh perl-rrdtool-1.2.18-1.el5.rf.i386.rpm --nodeps
# rpm -ivh rrdtool-1.2.18-1.el5.rf.i386.rpm
# tar -zxf pnp-0.4.13.tar.gz
# cd pnp-0.4.13
# ./configure
# make all
# make install
# make install-config
# make install-init
# ln -s /usr/local/nagios/share/pnp /usr/local/apache/htdocs/pnp
# cd /usr/local/nagios/etc/pnp
# mv misccommands.cfg-sample misccommands.cfg
# mv nagios.cfg-sample nagios.cfg
# mv npcd.cfg-sample npcd.cfg
# mv process_perfdata.cfg-sample process_perfdata.cfg
# mv rra.cfg-sample rra.cfg
# cd 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
启动npcd服务
# service npcd start
开机自启动npcd
# vi /etc/rc.local
service npcd start
:wq
注:这一版本的pnp还不支持chkconfig命令,pnp4支持
# vi /usr/local/nagios/etc/nagios.cfg (把前面的注释符"#"去掉)
process_performance_data=1 (原为process_performance_data=0)
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
:wq
# vi /usr/local/nagios/etc/objects/commands.cfg
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/local/nagios/libexec/process_perfdata.pl
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/local/nagios/libexec/process_perfdata.pl
}
:wq
注:要注释掉原有对process-service-perfdata和process-host-perfdata的定义
为主机添加小太阳图标
# vi /usr/local/nagios/etc/objects/yang.cfg
define host {
use linux-server
host_name yang
address 192.168.1.10
action_url /pnp/index.php?host=$HOSTNAME$
}
:wq
为单个服务添加小太阳图标
# vi /usr/local/nagios/etc/objects/yang.cfg
define service {
use generic-service
host_name yang
service_description check_load
check_command check_nrpe!check_load
normal_check_interval 2
action_url /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
}
:wq
重启nagios
# service nagios restart
# ls /usr/local/nagios/share/perfdata (看有没有nagios中定义的主机名)
注:nagio图像(pnp)只能显示nagios插件中的服务,以脚本监控的服务不显示图像