Nagios Cacti完全安装与整合(2)

五、nagios性能分析图表_PNP插件
yum install perl-Time-HiRes

先安装rrdtool
32位系统
wget
rpm -Uvh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
yum -y install rrdtool
64位系统
wget
rpm -Uvh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
yum -y install rrdtool

1.安装PNP
tar zxvf pnp4nagios-0.6.16.tar.gz
cd pnp4nagios-0.6.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-rrdtool=/usr/bin/rrdtool
make all
make install
make install-webconf
make install-config
make install-init

2.配置PNP
cd /usr/local/pnp4nagios/etc
mv misccommands.cfg-sample  misccommands.cfg
mv nagios.cfg-sample  nagios.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
service npcd start

3.修改 nagios 的配置文件,打开performance_data
cd /usr/local/nagios/etc
vi nagios.cfg

process_performance_data=1   //把0变成1,启动nagios的数据输出功能,这样nagios将收集的数据写入到某个文件当中,以备提取!
host_perfdata_command=process-host-perfdata        //启用主机的数据输出功能
service_perfdata_command=process-service-perfdata  //启用服务的数据输出功能

4.修改 commands.cfg
cd /usr/local/nagios/etc/objects
vim commands.cfg
把默认的process-host-perfdata和process-service-perfdata 删除掉或注释掉,添加如下内容:

# '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
        }

5.添加模板
vim templates.cfg
在配置文件最后添加
define host {
name       hosts-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&
register   0
}
define service {
name       services-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register   0
}

6.最后在各服务器的hosts和services处添加hosts-pnp、services-pnp
如:
define host{
        use               linux-server,hosts-pnp 
        host_name         andy.com
        alias             andy_web.com
        address           192.168.1.101
        }


define service{
        use                        local-service,services-pnp     
        host_name                  andy.com
        service_description        PING
        check_command              check_ping!100.0,20%!500.0,60%
}

7.重启nagios
/etc/init.d/nagios restart

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/6c3d69c5560e55fe936d144eb79b473f.html