在安装pnp-nagios之前应该安装
php
rrdtool
apt-get install php5
apt-get install rrdtool
apt-get install php5-gd
tar -zxvf pnp-04.4.14.tar.gz
cd pnp**
./configure --prefix=/etc/nagios3/
*** Configuration summary for pnp 0.4.13 02-19-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /etc/nagios3
HTML Dir: /etc/nagios3/share/pnp
Config Dir: /etc/nagios3/etc/pnp
Path to rrdtool: /usr/bin/rrdtool (Version 1.2.23)
RRDs Perl Modules: FOUND (Version 1.2023)
RRD Files stored in: /etc/nagios3/share/perfdata
process_perfdata.pl Logfile: /etc/nagios3/var/perfdata.log
Perfdata files (NPCD) stored in: /etc/nagios3/var/spool/perfdata/
make all
make install
make install-config
make install-init
cp /etc/nagios3/etc/process_perfdata.cfg-sample /etc/nagios3/et/process_perfdata.cfg
vi /etc/nagios3/etc/process_perfdata.cfg
修改
LOG_LEVEL=2
修改 nagios.cfg文件
将process_performance_data=1 改为1
service_perfdata_command=process-service-perfdata
host_perfdata_command=process-host-perfdata
将注示去除
修改commands.cfg
# 'process-host-perfdata' command definition
define command{
#command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
command_line /etc/nagiso3/libexec/process_perfdata.pl 注示上面的行,添加下面的内容
command_name process-host-perfdata
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
#command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
注示上面的行添,加下面的内容
command_line /etc/nagios3/libexec/process_perfdata.pl
}
修改/etc/nagios3/conf.d/generic-service_nagios2.cfg
添加如下内容
define service{
name srv-pnp
register 0
action_url /nagios3/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$' onmouseover="get_g('$HOSTNAME$','$SERVICEDESC$')" onmouseout="clear_g()"
}
修改/etc/nagios3/conf.d/generic-host_nagios2.cfg
添加如下内容
define host{
name host-pnp
register 0
action_url /nagios3/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$' onmouseover="get_g('$HOSTNAME$','$SERVICEDESC$')" onmouseout="clear_g()"
}
在/etc/apache2/conf.d/nagios3.conf 中添加如下内容
Alias /nagios3/pnp /etc/nagios3/share
修改 localhost.cfg
define host{
use generic-host,srv-pnp ; Name of host template to use
host_name localhost
alias localhost
address 127.0.0.1
}
# Define a service to check the disk space of the root partition
# on the local machine. Warning if < 20% free, critical if
# < 10% free space on partition.
define service{
use generic-service,srv-pnp ; Name of service template to use
host_name localhost
service_description Disk Space
check_command check_all_disks!20%!10%
}
还须要修改一下权限
chmod -R 777 /etc/nagios3/var 或 chown -R nagios:nagios /etc/nagios3/var
chmod -R 777 /etc/nagios3/share/perfdata 或 chown -R nagios:nagios: /etc/nagios3/share/perfdata
测试
重启 apache2 nagios3
http://****/nagios3/pnp
阅读(805) | 评论(0) | 转发(0) |