大网数据广告活动
服务器运维问答

Nagios NRPE won't allow arguments

· 52CE 我爱测

I am trying to use a Nagios NRPE plugin to communicate with my servers. I have a command definition in /etc/nagios/nrpe_local.cfg to use it: command[check_service]=/usr/lib/nagios/plugins/check_service -s $ARG1$ When I manually r…

问题原文

原帖链接 · Canadian Luke · CC BY-SA 4.0

I am trying to use a Nagios NRPE plugin to communicate with my servers. I have a command definition in /etc/nagios/nrpe_local.cfg to use it:

command[check_service]=/usr/lib/nagios/plugins/check_service -s $ARG1$

When I manually run the command in my terminal, it succeeds:

# /usr/lib/nagios/plugins/check_service -s bind9
OK: Service bind9 is running!

When I try running it from my Nagios Server, it complains the command is not defined:

# /usr/lib/nagios/plugins/check_nrpe -H 10.32.10.3 -c check_service -a bind9
NRPE: Command 'check_service!bind9' not defined

Other check_nrpe commands work, so I don't think there is an issue in the server's commands.cfg, but here is the definition anyways:

define command {
    command_name        check_nrpe
    command_line        /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
}

The check would look like this on the server:

define service {
    use                 local-service
    host_name           dc1,dc2
    service_description BIND Service
    check_command       check_nrpe!check_service!bind9
}

On the web interface, it returns CRITICAL: Service is not running!, which is not actually the case.

How can I get check_nrpe to allow the one extra argument? I have tried enabling dont_blame_nrpe, but that did not allow it to go either.

Edit - With debug turned on, and re-running the check, I get the following in my 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.

I have verified that the Group in /etc/systemd/system/multi-user.target.wants/nagios-nrpe-server.service matches the nrpe_group parameter in /etc/nagios/nrpe.cfg. The same user exists in /etc/group and /etc/passwd.

已采纳解答

原帖链接 · Canadian Luke · CC BY-SA 4.0

The issue is that the Debian package does not set --enable-command-args when building the nagios-nrpe-server package, which is what's required to use dont_blame_nrpe.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-12-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。