安装插件
以 ubuntu14.04 环境为基础的编译配置
<pre> git clone git://github.com/flackem/check_multi cd check_multi ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-checkresults_dir=/var/lib/nagios3/spool/checkresults/ --with-plugin_path=/usr/lib/nagios/plugins/ make all make install make install-config </pre>
nagios 服务端配置
定义被动检测服务
<pre> #--- 定义要被动检测命令 define command{ command_name check_dummy command_line $USER1$/check_dummy $ARG1$ $ARG2$ } #--- 定义要监控的主机服务 host1 define service { service_description system_disk host_name host1 passive_checks_enabled 1 active_checks_enabled 0 check_command check_dummy!0 "passive check" use generic-service } define service { service_description system_load host_name host1 passive_checks_enabled 1 active_checks_enabled 0 check_command check_dummy!0 "passive check" use generic-service } define service { service_description system_swap host_name host1 passive_checks_enabled 1 active_checks_enabled 0 check_command check_dummy!0 "passive check" use generic-service } define service { service_description proc_rsyslogd host_name host1 passive_checks_enabled 1 active_checks_enabled 0 check_command check_dummy!0 "passive check" use generic-service } </pre>
nagios被监控端配置
feed_passive.cmd
<pre> #--- feed_passive command file command [ system_disk ] = /usr/lib/nagios/plugins/check_disk -w 5% -c 2% -p / command [ system_load ] = /usr/lib/nagios/plugins/check_load -w 10,8,6 -c 20,18,16 command [ system_swap ] = /usr/lib/nagios/plugins/check_swap -w 90 -c 80 command [ proc_syslogd ] = /usr/lib/nagios/plugins/check_procs -c 1: -C syslogd #--- avoid redundant states state [ WARNING ] = IGNORE state [ CRITICAL ] = IGNORE state [ UNKNOWN ] = IGNORE </pre>
获取检测结果
这里的例子是 使用send_multi 发送结果, 关于gearman相关配置参考
<pre> export PATH=$PATH:/usr/lib/nagios/plugins/ check_multi -f /etc/check_multi/feed_passive.cmd -r 256 | send_multi --server=10.2.0.119:4730 --encryption=yes key="l@bs&d156405189" --host="passive_1" </pre>