Build precise queries to find exactly what you need
Press ESC to close
Thanks for the check.
I like to be able to check both IPv6 and IPv4, so that is what the edit below does: (Paths used in this script are adapted for Debian/ Ubuntu based systems.)
#!/bin/bash
case $# in 1) case $1 in -4) IPT=’/sbin/iptables’ ;; -6) IPT=’/sbin/ip6tables’ ;; *) ;; esac
GREP=’/bin/grep’ AWK=’/usr/bin/awk’ EXPR=’/usr/bin/expr’ WC=’/usr/bin/wc’
STAT=0 OUTPUT=” CHAINS=`$IPT -nvL | $GREP ‘Chain’ | $AWK ‘{ print $2 }’`
for CHAIN in $CHAINS ; do if [ “$CHAIN” != ‘FORWARD’ ] && [ “$CHAIN” != ‘OUTPUT’ ] && [ `$EXPR substr $CHAIN 1 4` != “LOG_” ] ; then CNT=`expr $($IPT -S $CHAIN | $WC -l) ‘-‘ 1` if [ $CNT -eq 0 ] ; then OUTPUT=”${OUTPUT}ERROR $CHAIN $CNT rules!” STAT=2 else OUTPUT=”${OUTPUT}OK $CHAIN $CNT rules” fi fi done
echo $OUTPUT
exit $STAT ;; *) echo “Usage: $0 [-4][-6]” exit 1 ;; esac
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!