1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-31 21:33:43 +00:00

iptables-related plugins: use "-w" for consistent results

The parameter "-w" forces iptables to wait for a lock before
printing data.

The parameter requires iptables 1.6 (released 2015).

See https://github.com/munin-monitoring/munin/issues/586
This commit is contained in:
Lars Kruse 2018-02-24 22:58:04 +01:00
parent 0b07e636e2
commit c9157be3fe
7 changed files with 31 additions and 31 deletions

View file

@ -28,7 +28,7 @@ IP=`basename $0 | sed 's/^ip6_//g' | tr '_' ':' `
if [ "$1" = "autoconf" ]; then
if [ -r /proc/net/dev ]; then
ip6tables -L INPUT -v -n -x >/dev/null 2>/dev/null
ip6tables -L INPUT -v -n -x -w >/dev/null 2>/dev/null
if [ $? -gt 0 ]; then
echo "no (could not run ip6tables as user `whoami`)"
exit 1
@ -43,7 +43,7 @@ if [ "$1" = "autoconf" ]; then
fi
if [ "$1" = "suggest" ]; then
ip6tables -L INPUT -v -n -x 2>/dev/null | awk --posix '$8 ~ /^([0-9a-f]{1,4}(\:|\:\:)){1,7}([0-9a-f]{1,4})\/([0-9]{1,3})$/ { if (done[$8]!=1) {print $8; done[$8]=1;}}'|sed "s#/[0-9]\{1,3\}##"
ip6tables -L INPUT -v -n -x -w 2>/dev/null | awk --posix '$8 ~ /^([0-9a-f]{1,4}(\:|\:\:)){1,7}([0-9a-f]{1,4})\/([0-9]{1,3})$/ { if (done[$8]!=1) {print $8; done[$8]=1;}}'|sed "s#/[0-9]\{1,3\}##"
exit 0
fi
@ -64,5 +64,5 @@ if [ "$1" = "config" ]; then
exit 0
fi;
ip6tables -L INPUT -v -n -x | grep -m1 $IP | awk "{ print \"in.value \" \$2 }"
ip6tables -L OUTPUT -v -n -x | grep -m1 $IP | awk "{ print \"out.value \" \$2 }"
ip6tables -L INPUT -v -n -x -w | grep -m1 $IP | awk "{ print \"in.value \" \$2 }"
ip6tables -L OUTPUT -v -n -x -w | grep -m1 $IP | awk "{ print \"out.value \" \$2 }"