mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +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:
parent
0b07e636e2
commit
c9157be3fe
7 changed files with 31 additions and 31 deletions
|
@ -45,7 +45,7 @@ iptables='/sbin/iptables'
|
|||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -r /proc/net/dev ]; then
|
||||
RES=`$iptables -L $TNAME -nvx 2>&1 >/dev/null`
|
||||
RES=`$iptables -L $TNAME -nvx -w 2>&1 >/dev/null`
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "no (could not run iptables as user `whoami`; $RES)"
|
||||
exit 1
|
||||
|
@ -79,7 +79,7 @@ if [ "$1" = "initialise" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
IFACES=`$iptables -L munin_node -nvx | awk '$6 ~ /(eth|ppp)[0-9]/ { if (done[$6]!=1) {print $6; done[$6]=1;}}'`
|
||||
IFACES=`$iptables -L munin_node -nvx -w | awk '$6 ~ /(eth|ppp)[0-9]/ { if (done[$6]!=1) {print $6; done[$6]=1;}}'`
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
|
@ -108,7 +108,7 @@ if [ "$1" = "config" ]; then
|
|||
fi;
|
||||
|
||||
if [ "$TYPE" = "pkts" ]; then
|
||||
$iptables -L munin_node -nvx | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$1 }"
|
||||
$iptables -L munin_node -nvx -w | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$1 }"
|
||||
else
|
||||
$iptables -L munin_node -nvx | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$2 }"
|
||||
$iptables -L munin_node -nvx -w | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$2 }"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue