一、首先安装rrdtool
1、tar zxvf rrdtool-1.4.7.tar.gz
2、./configure --prefix=/usr/local/rrdtool-1.4.7
3、make
4、make install
5、perl -MRRDs -le 'print q(ok!)' #如果检测出错执行下面两步
6、ln -sv /usr/local/rrdtool-1.4.7/lib/perl/5.8.8/x86_64-linux-thread-multi/auto/RRD /usr/lib/perl5/5.8.8/
7、ln -sv /usr/local/rrdtool-1.4.7/lib/perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib/perl5/5.8.8/
二、安装pnp4
1、tar zxvf pnp4nagios-0.6.6.tar.gz
2、cd pnp4nagios-0.6.6
3、./configure --prefix=/usr/local/pnp4nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-rrdtool=/usr/local/rrdtool-1.4.7/bin/rrdtool --with-perfdata-dir=/usr/local/nagios/share/perfdata --with-httpd-conf=/etc/httpd/conf.d
4、make all
5、make install
6、make install-webconf
7、make install-config
8、make install-init
9、make fullinstall
三、让pnp随系统启动
chkconfig --add npcd
chkconfig npcd on
四、修改nagios的主配置文件
process_performance_data=1 #默认为0
host_perfdata_command=process-host-perfdata #默认注释
service_perfdata_command=process-service-perfdata #默认注释
五、修改command.cfg文件
注释掉原有对process-host-perfdata和process-service-perfdata进行定义的字段,添加如下内容
define command {
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
六、修改templates.cfg文件,定义成模板,添加如下内容:
define host {
name host-pnp4
register 0
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
process_perf_data 1
}
define service {
name srv-pnp4
register 0
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips'rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
process_perf_data 1
}
七、让所有主机和服务调用pnp
修改templates.cfg文件中主机、以及服务的定义如:
define host{
name linux-server
use generic-host,host-pnp4
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period workhours
notification_interval 120
notification_options d,u,r
contact_groups admins
register 0
}
define service{
name local-service
use generic-service,srv-pnp4
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
register 0
}
八、复制鼠标悬停图标显示,预览绘图所需的文件 .
cp /root/soft/pnp4nagios-0.6.6/contrib/ssi/* /usr/local/nagios/share/ssi/
九、升级php(pnp 0.6.6要求PHP5.2以上版本)
1、使用网上能升级PHP的yum源,修改本地yum配置文件如下:
[php]
name=updatePHP
baseurl=
enabled=1
gpgcheck=1
gpgkey=
2、yum update php -y
3、yum install php*-gd
pnp安装完
阅读(3653) | 评论(0) | 转发(0) |