Hi, Can anyone help?
I've written a basic plugin which works on the remote server but when I run it from the Nagios master server it always returns the same output. The script does the following
#!/bin/sh
#set -x
#
PATH=/bin:/sbin:/usr/bin:/usr/local/bin:/apps/lsf/7.0/linux2.6-glibc2.3-x86_64/bin/bhosts
export PATH
EXIT=0
QUEUE_STATE="`/apps/lsf/7.0/linux2.6-glibc2.3-x86_64/bin/bhosts -w host1 |/bin/grep -v STATUS|/bin/awk '{print $2}' `"
if [[ "$QUEUE_STATE" = "ok" ]] ;then
echo "0:$QUEUE_STATE"
exit 0
fi
if [[ "$QUEUE_STATE" != "ok" ]] ;then
echo "2:$QUEUE_STATE"
exit 2
fi
the output from the bhosts -w command is below I'm just after the STATUS result which is either 'ok' or 'closed'
[root@host1libexec]# bhosts -w host1
HOST_NAME STATUS JL/U MAX NJOBS RUN SSUSP USUSP RSV
host1 ok - 8 3 3 0 0 0
permissions for the script are
-rwxr-xr-x 1 nagios nagios 394 Jun 15 09:27 check_queue.p1
When I run the script on the remote host it returns
[root@libexec]# /usr/local/nagios/libexec/check_queue.p1
0:ok
[root@libexec]#
When I run it from the nagios master it always returns 2: even if the queue is ok
[root@master libexec]# /usr/local/nagios/libexec/check_nrpe -H host1 -c check_queue.p1
2:
[root@master libexec]#
Can anyone help? its driving me mad