When I run the command as the nagios user it works on the client. When I run the command from the nagios server it fails with NRPE: Unable to read output.
Below is the script.
Code: Select all
#!/bin/bash
while test -n "$1"; do
case "$1" in
-w)
WarnInodes=$2
shift
;;
-c)
CritInodes=$2
shift
;;
-p)
Partition=$2
shift
;;
esac
shift
done
sid=`sudo df -h |awk '{print $NF}' | grep oraarch`
if [ $sid -z ];
then
echo "No oraarch."
exit 0
else
inode=`sudo df -h $sid | awk '{print $5}' | grep -vi Cap | sed 's/%//g'`
#inode=81
#echo $inode $WarnInodes $CritInodes
if [ "$inode" -lt "$WarnInodes" ];
then
echo "$sid disk space $inode% used"
exit 0
fi
if [ "$inode" -gt "$WarnInodes" -a "$inode" -lt "$CritInodes" ];
then
echo "$sid disk space $inode% used"
exit 1
fi
if [ "$inode" -gt "$CritInodes" ];
then
echo "$sid disk space $inode% used"
exit 2
fi
fi
command[check_orarch_space]=/etc/nagios/nrpe/check_orarch_space $ARG1$
Command on client:
root@client nagios # sudo su - nagios
-bash-3.2$ /etc/nagios/nrpe/check_orarch_space -w 10 -c 80
No oraarch.
-bash-3.2$ echo $?
0
Command on nagios server:
[root@nagios /]# /usr/local/nagios/libexec/check_nrpe -H 136.205.105.86 -t 30 -c check_orarch_space -a '-w 89 -c 90'
NRPE: Unable to read output
Permissions are all atleast 700 nagios on all the scripts.
The NRPE agent is talking to the nagios server and getting some results: