nrpe unable to read output

Jasmin shahrzad
Jasmin shahrzad used Ask the Experts™
on
i have a very little script which is running when i use   $ ./check_dock
docker -com.... ok cpuuerc 0.xx%
 when i used in $ ./check_nrp -H "ip/localhost/127.0.0.1" -c check_dock
return:  NRPE: Unable to read output
all other command i defined in nrpe is running.
What i missing here?

my check_dock scripts is:
-------
#!/bin/bash -el
#
#
#
# Author: Bahman Sharzad
# Mail: bshmsn.sharzad@process-factory.dk

SUDO=/usr/bin/sudo
alias direc="cd /usr/local/nagios/libexec"
# . check docker container
ERROR_CODE1=-1
statu=$((sudo /usr/local/nagios/libexec/check_docker -n $1 -c 80,90) | awk '{print $2}')
#echo $statu
all=$(sudo /usr/local/nagios/libexec/check_docker -n $1 -c 80,90)
#echo $all
if [ $statu = 'WARN' ]; then
        echo $all
        ERROR_CODE1=1
elif [ $statu = 'CRIT' ]; then
        echo $all
        ERROR_CODE1=2
elif [ $statu = 'OK' ]; then
        echo $all
        ERROR_CODE1=0
fi
exit $ERROR_CODE1
------

and command in nrpe is
--
command[check_dock]=/usr/local/nagios/libexec/check_dock docker-compose_mongodb_1
---
i run command :  $ sudo ./check_nrpe -H 127.0.0.1 -c check_dock
NRPE: Unable to read output
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
have you tried the trouble shooting steps for check_nrpe? https://support.nagios.com/kb/article/nrpe-nrpe-unable-to-read-output-620.html

Looks like on the remote host, NRPE is not installed, or it is not installed correctly.

Author

Commented:
Yes yes. nrpe is install for a long time ago and i check status as cpu, disk, memory oracle,.... .
Commented:
So when you run the following command with the remore host IP you get back the NRPE version? also, just to be clear, are you actually using the IP 127.0.0.1 during the test or is that just a placeholder to keep your actual IP private?

[root@nagios libexec]# ./check_nrpe -H 10.73.158.12                                                                                      
NRPE v3.2.1

Author

Commented:
Issue is solved. problem was in my code. it was a wrong else after my if.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial