A、安装相关环境
需要安装rrdtool及相关工具,此工具编译起来非常烦人,受不了的话可以从网上找第三方源。 B、安装PNP4Nagios
下载后
./configure --with-nagios-user=nagios --with-nagios-group=nagcmd
make all
make install
make install-webconf
make install-config
make install-init
#使用下面这条命令可以替换所有的make命令
make fullinstall
C、配置PNP4Nagios
PNP4Nagios有三种工作模式,分别是Synchronous Mode、Bulk Mode和Bulk Mode with NPCD,下面以Synchronous Mode来配置PNP4Nagios。
修改Nagios的主配置文件
vi /usr/local/nagios/etc/nagios.cfg
process_performance_data=1
service_perfdata_command=process-service-perfdata
host_perfdata_command=process-host-perfdata
修改Nagios的command.cfg配置文件
vi /usr/local/nagios/etc/objects/commands.cfg
define host{
use linux-server,host-pnp ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name 192.168.1.106
alias 192.168.1.106
address 192.168.1.106
}
define service{
use generic-service,srv-pnp ; Name of service template to use
host_name 192.168.1.106
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}