实现nagios的图表显示
1、检查需要支持的系统套件是否都已经安装:
[root@localhost ]# yum install httpd php
[root@localhost ]# yum install gcc glibc glibc-common
[root@localhost ]# yum install gd gd-devel php-gd
2、安装需要支持的系统套件:
[root@localhost ]# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
(下载地址: 选择相应版本下载)
[root@localhost ]# yum install rrdtool (安装绘图所需要的套件包)
3、安装nagios图表插件:(下载地址:)
[root@localhost ]# tar -zxvf pnp4nagios-0.6.12.tar.gz
[root@localhost ]# cd pnp4nagios-0.6.12
[root@localhost ]# ./configure (默认安装路径是/usr/local/pnp4nagios)
[root@localhost ]# make all
[root@localhost ]# make install
[root@localhost ]# make fullinstall
[root@localhost ]# ls /usr/local/nagios/ (查看有无pnp4nagios目录,安装成功会有这个)
4、修改nagios程序中的配置:
(1)修改主配置程序nagios.cfg文件:
[root@localhost ]# vim /usr/local/nagios/etc/nagios.cfg
process_performance_data=0 (把这边的0改为1)
#host_perfdata_command=process-host-perfdata (去掉前面的注释号#)
#service_perfdata_command=process-service-perfdata (去掉前面的注释号#)
(2)修改命令配置程序commands.cfg文件:
[root@localhost ]# vim /usr/local/nagios/etc/objects/commands.cfg
# '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 (修改这一行)
} (把原来的长串输出打印命令改为上面这个绘图控件执行)
(3)修改模板配置程序templates.cfg文件:
[root@localhost ]# vim /usr/local/nagios/etc/objects/templates.cfg
define service{
name generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 10
retry_check_interval 2
contact_groups admins
notification_options w,u,c,r
notification_interval 60
notification_period 24x7
register 0
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$