分类: LINUX
2008-12-05 11:45:53
Nagios的插件是真正工作在检测服务和主机工作的第一线的真正英雄,没有他,nagios系统只是一个空壳而已.因此,在安装了nagios平台之后的第一件事情就是将插件安装上去。
从nagios主页下载了最新的nagios官方插件,本文中用到的是nagios-plugins-
1、 解压
tar xzf nagios-plugins-
2、 编译
./configure --prefix=prefix
#变量prefix 为安装目录,例如/usr/local/nagios
3、 安装
make
make install
4、 检查
ls /usr/local/nagios/libexec
如果安装成功的话,你可以看到在这个目录下有很多可执行程序或者脚本,名称类似:check_icmp。
经过上述4个步骤,nagios的脚本就宣告安装成功,但是如何让这些脚本工作起来呢?nagios并没有提供每个监控程序的脚本的说明文档,想了解这些脚本如何工作的话,需要通过--h参数,显示其使用方法和参数。例如:
./check_icmp --h Usage: check_icmp [options] [-H] host1 host2 hostn Options: -h, --help Print detailed help screen -V, --version Print version information -H specify a target -w warning threshold (currently 200.000ms,0%) -c critical threshold (currently 500000.000ms,80%) -n number of packets to send (currently 5) -i max packet interval (currently 80.000ms) -I max target interval (currently 0.000ms) -m number of alive hosts required for success -l TTL on outgoing packets (currently 0) -t timeout value (seconds, currently 10) -b icmp packet size (currenly ignored) -v verbose ... |
./check_icmp -H OK - : rta 33.632ms, lost 0%|rta=33.632ms;200.000;500.000;0; pl=0%;40;80;; |
define service { host_name TestSSH service_description check_ssh check_command check_ssh } |
define host { host_name test.VN alias test.VN address 192.168.0.1 check_command check-host-alive } |
# 'check-host-alive' command definition define command{ command_name check-host-alive command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1 } |
|
# 'check_http' command definition define command{ command_name check_http command_line $USER1$/check_http -H $HOSTADDRESS$ -p $ARG1$ } |
define service { host_name ... ... check_command check_http!8080 } |