nagios 插件

前提: nagios已经安装好。本文环境:centos5.4
1. NagiosGrapher插件安装
# yum install autoconf rrdtool perl perl-base perl-modules perl-Calendar-Simple perl-GD ImageMagick-perl rrdtool-perl perl-URI-Template
# wget http://downloads.sourceforge.net/project/nagiosgrapher/nagiosgrapher/NagiosGrapher-1.7.1/NagiosGrapher-1.7.1.tar.gz?use_mirror=nchc
# tar -zxvf NagiosGrapher-1.7.1.tar.gz
# cd NagiosGrapher-1.7.1
# autoconf
# ./configure --prefix=/usr/local/nagios --with-web-user=apache --with-web-group=apache --with-nagios-user=nagios --with-layout=default
# make testdeps       
/usr/bin/perl ./tools/testdeps.pl
Checking Data::Dumper ... found
Checking File::Copy ... found
Checking File::Basename ... found
Checking Carp ... found
Checking POSIX ... found
Checking Time::HiRes ... found
Checking Time::Local ... found
Checking Storable ... found
Checking GD ... found
Checking Image::Magick ... found
Checking RRDs ... found
Checking CGI ... found
Checking CGI::Carp ... found
Checking IO::Handle ... found
Checking URI::Escape ... found
Checking Calendar::Simple ... found
# 说明:
# 全部为found才能继续编译,否则出错,以上支持全部为perl的支持包。可以用上面yum全部安装完毕。

# make && make install

2. 修改nagios配置文件
# vi /usr/local/nagios/etc/nagios.cfg
# 加入以下内容
cfg_dir=/usr/local/nagios/etc/serviceext
process_performance_data=1
service_perfdata_file=/usr/local/nagios/var/service-perfdata
service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\t$TIMET$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata-file

# vi /usr/local/nagios/etc/objects/commands.cfg
# 加入以下内容
define command{
       command_name process-service-perfdata-file
       command_line mv /usr/local/nagios/var/service-perfdata /usr/local/nagios/var/service-perfdata.$TIMET$
}

3. 添加服务启动
# wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
# tar -zxvf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
# cd apps/sys-utils/start-stop-daemon-IR1_9_18-2/
# gcc start-stop-daemon.c  -o start-stop-daemon
# cp start-stop-daemon /usr/bin/
# service nagios_grapher start
# service nagios reload   

4. 测试查看
http://nagios.koumm.com
在服务名后面会出现一个图标,点进入可以看到图像。如图
nagios NagiosGrapher插件安装 - koumm - koumm的博客

你可能感兴趣的:(职场,nagios,休闲)