Hi,
Here is the code i use to check if iptables has some filters in it:
#!/bin/sh
OK_STATE=0
WARNING_STATE=1
CRITICAL_STATE=2
UNKNOWN_STATE=3
cnt=/sbin/iptables -nvL | /bin/grep -c "Uitgaand"
if “$cnt” = “0” ]
then
echo "CRITICAL: IPTABLES is not RUNNING"
exit $CRITICAL_STATE
elif “$cnt” = “1” ]
then
echo "OK: IPTABLES is RUNNING"
exit $OK_STATE
else
echo "UNKNOWN: IPTABLES is UKNOWN"
exit $UNKNOWN_STATE
fi
locally it runs great and gives me the correct exit state, but when i run it using nrpe it always return with an error in nagios, what am i doing wrong?