Page 1 of 1

NRPE unable to read output

Posted: Wed Jan 18, 2012 4:52 am
by patrick2011
Hi,

When I run a script local, the script is working fine but when I run it with check_nrpe on the nagios server i'll get "NRPE: unable to read output"

The script:

Code: Select all

/usr/sbin/zoneadm list -ip > /tmp/zoneinfo
msg=

cat /tmp/zoneinfo | while read info
do
zone=`echo $info | cut -d : -f 2`
state=`echo $info | cut -d : -f 3`
if [ "$state" = "running" ]; then
        msg="OK: zone $zone is in running state "
else
        msg="CRITICAL: Zone $zone is in $state "
        $status = 2
fi
echo $msg
done

if [ "$status" = "2" ]; then
        sort $msg
        exit 2
fi
rm /tmp/zoneinfo
exit 0
So, when I use "/usr/bin/zoneadm list -ip" is fails, but when I change this command to e.g. "/usr/bin/ls -la /tmp" I get output from check_nrpe on the nagios server.
Also debug mode doesn't give any extra output.

Can anyone tell what is happening here?

Re: NRPE unable to read output

Posted: Wed Jan 18, 2012 5:45 pm
by jsmurphy
Are you able to post the relevant piece of your nrpe config for executing the script?

You may also want to check that the user that the nrpe client runs as (usually nagios) has sufficient privileges to execute the script correctly.

Re: NRPE unable to read output

Posted: Thu Jan 19, 2012 8:32 am
by patrick2011
Hi,

When I didn't have the sufficient privileges to execute the script it would give me any output.
It gives me output with "ls -la" but not with "zoneadm"

The problem was an update of the libs on the server.
It gave an segv on zoneadm.

So problem is solved.

Re: NRPE unable to read output

Posted: Thu Jan 19, 2012 5:21 pm
by jsmurphy
Glad you solved the issue.