一、安装RRDTOOL:
#tar zxvf rrdtool-1.2.14.tar.gz 下载地址:
#cd rrd-1.2.4
#./configure --with-rrdtool=/usr/local/rrdtool/bin/rrdtool --with-perfdata-dir=/usr/local/nagios/share/perfdata
#make
#make install
二、安装PNP:
#tar zxvf pnp-0.4.10.tar.gz
#cd pnp-0.4.10
#./configure
#make
#make install
当时安装Nagios时,PHP没有安装GD库支持,因此需要对PHP重新编译:
三、安装GD库:
#tar zxvf gd-2.0.33.tar.gz
#cd gd-2.0.33
#./configure --freetype --libpng --?
#make
#make intall
四、编译PHP:
#cd php-5.2.4.tar.gz
#./configure --prefix=/usr/local/php/ --with-apxs2=/usr/local/apache/bin/apxs --with-gd2 --with-zlib --with-freetype
#make
#make install
访问nagios/pnp/index.php?host=localhost 看到图形即表示OK。
五、修改Nagios.cfg文件:
process_performance_data=1
service_perfdata_command=process-service-perfdata #默认此句被注释掉了
六、修改service.cfg,在末尾处加入:
define service {
name srv-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
}
七、修改localhost.cfg,加入:
define host{
use linux-server ; 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 localhost
alias localhost
address 127.0.0.1
process_perf_data 1
action_url /nagios/pnp/index.php?host=$HOSTNAME$
}
然后
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
校验下,看配置是否有错,重新启动nagios:
#/etc/init.d/nagios restart
就可以看到监控的主机旁边多出了“小太阳”图标了。点击“小太阳”图标,就可以看到监控图了
阅读(501) | 评论(0) | 转发(0) |