Nagios Check NRPE and Executing scripts show different outputs

630 Views Asked by At

When executing a script through check_nrpe and executing it from local server displays two different out puts.

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.

[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.

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

I have tried restarting the NRPE and Nagios Core. Also double checked the permission issues.

1

There are 1 best solutions below

0
Dinuka Kavinda On

This was due to the curl and libcurl mismatch. The nagios user can't curl properly. Downgraded the packages to be the same.