I ran the following as the nagios user...
When I run my script on the client I get:
bash-4.1$ /etc/nagios/nrpe/check_disk_inodes -w 80 -c 90
/oracle/DX1 inodes 3% used
bash-4.1$ echo $?
0
When I run the check NRPE command from the Nagios Server I get:
bash-4.1$ /usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx -t 30 -c check_disk_inodes -a '-w 80 -c 90'
/oracle/DX1 inodes 3% used
bash-4.1$ echo $?
2
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 oracle | egrep -v '(log|arch|data|oracle$)'`
inode=`sudo df -o i $sid | awk '{print $4}' | grep -v iused | sed 's/%//g'`
#echo $inode $WarnInodes $CritInodes
if [ "$inode" -lt "$WarnInodes" ];
then
echo "$sid inodes $inode% used"
exit 0
fi
if [ "$inode" -gt "$WarnInodes" -a "$inode" -lt "$CritInodes" ];
then
echo "$sid inodes $inode% used"
exit 1
fi
if [ "$inode" -gt "$CritInodes" ];
then
echo "$sid inodes $inode% used"
exit 2
fi