我正在尝试使用Nagios NRPE插件与我的服务器进行通信。我在/etc/nagios/nrpe_local.cfg中有一个命令定义来使用它:
command[check_service]=/usr/lib/nagios/plugins/check_service -s $ARG1$当我在我的终端中手动运行命令时,它会成功:
# /usr/lib/nagios/plugins/check_service -s bind9
OK: Service bind9 is running!当我尝试从Nagios Server运行它时,它会抱怨没有定义命令:
# /usr/lib/nagios/plugins/check_nrpe -H 10.32.10.3 -c check_service -a bind9
NRPE: Command 'check_service!bind9' not defined其他check_nrpe命令可以工作,因此我不认为服务器的commands.cfg中存在问题,但以下是定义:
define command {
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
}服务器上的检查如下所示:
define service {
use local-service
host_name dc1,dc2
service_description BIND Service
check_command check_nrpe!check_service!bind9
}在web接口上,它返回CRITICAL:服务没有运行!,实际上并非如此。
我如何让check_nrpe允许一个额外的参数?我尝试过启用dont_blame_nrpe,但这也不允许它运行。
编辑-打开调试,并重新运行检查,我在syslog中得到了以下内容:
Dec 19 09:01:56 dc1 nrpe[5586]: CONN_CHECK_PEER: checking if host is allowed: 10.32.10.12 port 33962
Dec 19 09:01:56 dc1 nrpe[5586]: Connection from 10.32.10.12 port 33962
Dec 19 09:01:56 dc1 nrpe[5586]: is_an_allowed_host (AF_INET): is host >10.32.10.12< an allowed host >10.32.10.12<
Dec 19 09:01:56 dc1 nrpe[5586]: is_an_allowed_host (AF_INET): is host >10.32.10.12< an allowed host >10.32.10.12<
Dec 19 09:01:56 dc1 nrpe[5586]: is_an_allowed_host (AF_INET): host is in allowed host list!
Dec 19 09:01:56 dc1 nrpe[5586]: Host address is in allowed_hosts
Dec 19 09:01:56 dc1 nrpe[5586]: Host 10.32.10.12 is asking for command 'check_service' to be run...
Dec 19 09:01:56 dc1 nrpe[5586]: Running command: /usr/lib/nagios/plugins/check_service -s
Dec 19 09:01:56 dc1 nrpe[5587]: WARNING: my_system() seteuid(0): Operation not permitted
Dec 19 09:01:56 dc1 nrpe[5586]: Command completed with return code 2 and output: CRITICAL: Service is not running!
Dec 19 09:01:56 dc1 nrpe[5586]: Return Code: 2, Output: CRITICAL: Service is not running!
Dec 19 09:01:56 dc1 nrpe[5586]: Connection from 10.32.10.12 closed.我已经验证了/etc/systemd/system/multi-user.target.wants/nagios-nrpe-server.service中的组与/etc/nagios/nrpe.cfg中的nrpe_group参数匹配。/etc/group和/etc/passwd中存在相同的用户。
发布于 2019-12-20 23:49:01
问题是Debian包在构建--enable-command-args包时没有设置nagios-nrpe-server,这是使用dont_blame_nrpe所必需的。
发布于 2019-12-19 04:26:46
dont_blame_nrpe后,确保重新启动nrpe守护进程https://serverfault.com/questions/996115
复制相似问题