Link to home
Start Free TrialLog in
Avatar of Jasmin shahrzad
Jasmin shahrzad

asked on

nrpe unable to read output

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
Avatar of Sanga Collins
Sanga Collins
Flag of United States of America image

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.
Avatar of Jasmin shahrzad
Jasmin shahrzad

ASKER

Yes yes. nrpe is install for a long time ago and i check status as cpu, disk, memory oracle,.... .
ASKER CERTIFIED SOLUTION
Avatar of Sanga Collins
Sanga Collins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Issue is solved. problem was in my code. it was a wrong else after my if.