+ -
当前位置:首页 → 问答吧 → Nagios NRPE插件对返回字符串的识别问题

Nagios NRPE插件对返回字符串的识别问题

时间:2011-12-23

来源:互联网

NRPE的配置文件里添加的command定义如下:
command[test_command]=/usr/local/nagios/libexec/test_command

这台机器是被监控的,在控制台出现以下情况:

----------------------------------------------
[root@centos6 libexec]# pwd
/usr/local/nagios/libexec
[root@centos6 libexec]# cat test_command
# !/bin/sh
REHEAD=$(clock)
echo "${REHEAD} ~12345"
exit 1
[root@centos6 libexec]# ./test_command
Thu 22 Dec 2011 06:50:24 PM CST -0.063304 seconds ~12345
[root@centos6 libexec]# ./check_nrpe -H localhost -c test_command
 ~12345
[root@centos6 libexec]#
----------------------------------------------

感觉在shell里面执行的命令返回出来的信息和直接echo出来的信息,对check_nrpe这个插件来说有些不一样。

求高手解释原因。


____________________________________

然后我试验直接在command的定义里面写命令形式:
command[direct_command]=/sbin/clock

调用check_nrpe的时候出现以下错误:
------------------------------------
[root@centos6 libexec]# /sbin/clock
Fri 23 Dec 2011 02:23:57 PM CST -0.173109 seconds
[root@centos6 libexec]# ./check_nrpe -H localhost -c direct_command
NRPE: Unable to read output
[root@centos6 libexec]#
------------------------------------



作者: xumeng1215   发布时间: 2011-12-23

很明显是nagios那些控制文件个人觉得是都变成2进制的文件了,你直接上面修改,肯定不行的

作者: fengyunsen4   发布时间: 2011-12-24