Linux Nagios/NRPE 给出“插件没有返回输出”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4044728/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 23:50:08  来源:igfitidea点击:

Nagios/NRPE giving a "No output returned from plugin" error

linuxmonitoringnagiosnrpe

提问by Rick

Getting a "No output returned from plugin" error message from a Nagios/NRPE script

从 Nagios/NRPE 脚本获取“插件没有返回输出”错误消息

1) Running Nagios v3.2.3 and NRPE v2.12

1) 运行 Nagios v3.2.3 和 NRPE v2.12

2) The script:

2)脚本:

   OK_STATE=0
   UNAME=/bin/uname -r       
   echo "OK: Kernel Version=$UNAME"       
   exit $OK_STATE

2) Command line results on the Nagios Server using NRPE

2) 使用 NRPE 在 Nagios Server 上的命令行结果

  • Same OK results for both the root and nagios users:
  • root 和 nagios 用户的结果相同:

[nagios@cmonmm03 libexec]$ ./check_nrpe -H dappsi01b.dev.screenscape.local -c check_kernel OK: Kernel Version=2.6.18-194.11.3.el5

[nagios@cmonmm03 libexec]$ ./check_nrpe -H dappsi01b.dev.screenscape.local -c check_kernel OK:内核版本=2.6.18-194.11.3.el5

When I run the check_kernel.sh script on the machine's local command line it works there to.

当我在机器的本地命令行上运行 check_kernel.sh 脚本时,它可以在那里工作。

Help, any thoughts or known solution regarding this would be appreciated?

帮助,关于此的任何想法或已知解决方案将不胜感激?

Thank you

谢谢

回答by timd

Did you add the nagios host to the /etc/xinetd.nrpe.cfg file? Specifically, the only_from line typically includes the localhost (on the remote system). Make sure to add the IPs of your nagios host there as well:

您是否将 nagios 主机添加到 /etc/xinetd.nrpe.cfg 文件中?具体来说, only_from 行通常包括本地主机(在远程系统上)。确保在那里添加你的 nagios 主机的 IP:

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
    flags           = REUSE
    socket_type     = stream
    port            = 5666
    wait            = no
    user            = nagios
    group           = nagios
    server          = /usr/local/nagios/bin/nrpe
    server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
    log_on_failure  += USERID
    disable         = no
    only_from       = 127.0.0.1 192.168.1.61
}

回答by Raman

Your command does not take any arguments, but it is likely the command definition for check_nrpe does define an argument parameter, for example:

您的命令不带任何参数,但 check_nrpe 的命令定义可能确实定义了一个参数参数,例如:

define command{
    command_name    check_nrpe
    command_line    /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}

Therefore, try placing a dummy argument in the service definition:

因此,尝试在服务定义中放置一个虚拟参数:

define service{
    use                             normal-service
    host_name                       hostname
    service_description             Description
    check_command                   check_nrpe!check_foo!placeholder
}