简体   繁体   English

Nagios Check NRPE 和 Executing scripts 显示不同的输出

[英]Nagios Check NRPE and Executing scripts show different outputs

When executing a script through check_nrpe and executing it from local server displays two different out puts.当通过 check_nrpe 执行脚本并从本地服务器执行它时,会显示两个不同的输出。

Script is similar to this.脚本与此类似。

url="http://xxx.xxx.xxx.xxx:5000/v2/_catalog";
status="$(curl --write-out %{http_code} --silent --output /dev/null  $url)"

    if [ "$status" = 200 ]
    then
            echo "OK"
            exit 0
    else
            echo "Not responding.Please check."
            exit 2
    fi

When executing this script file from the local server directly it generates the following output直接从本地服务器执行此脚本文件时,会生成以下输出

[root@xxxxxlibexec]$ ./check.sh 
OK

But when I execute this from the Nagios Core server through check_nrpe it generates the else block.但是当我通过 check_nrpe 从 Nagios Core 服务器执行它时,它会生成 else 块。

[root@xxxxx libexec]# ./check_nrpe -H xxx.xxx.xxx.xxx -p 5667 -c check_registry
Not responding.Please check.

The NRPE CFG command is as follows. NRPE CFG 命令如下。

command[check_registry]=/usr/local/nagios/libexec/check.sh

I have tried restarting the NRPE and Nagios Core.我尝试重新启动 NRPE 和 Nagios Core。 Also double checked the permission issues.还仔细检查了权限问题。

This was due to the curl and libcurl mismatch.这是由于 curl 和 libcurl 不匹配。 The nagios user can't curl properly. nagios 用户无法正确卷曲。 Downgraded the packages to be the same.将软件包降级为相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM