Révision c9157be3
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
| plugins/network/traffic_ipt | ||
|---|---|---|
| 110 | 110 |
diffv4=0 |
| 111 | 111 |
diffv6=0 |
| 112 | 112 |
|
| 113 |
IPv4_bytes=$(iptables -L -n -v -x | egrep '^\W*[0-9]+\W+[0-9]+\W+all\W+--\W+\*\W+\*\W+0.0.0.0/0\W+0.0.0.0/0\W*$' | while read pkts bytes rest; do echo $bytes; done) |
|
| 113 |
IPv4_bytes=$(iptables -L -n -v -x -w | egrep '^\W*[0-9]+\W+[0-9]+\W+all\W+--\W+\*\W+\*\W+0.0.0.0/0\W+0.0.0.0/0\W*$' | while read pkts bytes rest; do echo $bytes; done)
|
|
| 114 | 114 |
if [ -z "$IPv4_bytes" ]; |
| 115 | 115 |
then |
| 116 | 116 |
echo "W: Unable to read rule from iptables, please add rules" >&2 |
| ... | ... | |
| 118 | 118 |
ipv4=$(echo $IPv4_bytes | sed -e 's/ / + /' | bc -l) |
| 119 | 119 |
fi |
| 120 | 120 |
|
| 121 |
IPv6_bytes=$(ip6tables -L -n -v -x | egrep '^\W*[0-9]+\W+[0-9]+\W+all\W+\*\W+\*\W+::/0\W+::/0\W*$' | while read pkts bytes rest; do echo $bytes; done) |
|
| 121 |
IPv6_bytes=$(ip6tables -L -n -v -x -w | egrep '^\W*[0-9]+\W+[0-9]+\W+all\W+\*\W+\*\W+::/0\W+::/0\W*$' | while read pkts bytes rest; do echo $bytes; done)
|
|
| 122 | 122 |
if [ -z "$IPv6_bytes" ]; |
| 123 | 123 |
then |
| 124 | 124 |
echo "W: Unable to read rule from ip6tables, please add rules" >&2 |
Formats disponibles : Unified diff