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/fwbuilder_ | ||
|---|---|---|
| 61 | 61 |
|
| 62 | 62 |
if [ "$1" = "autoconf" ]; then |
| 63 | 63 |
if [ -r /proc/net/dev ]; then |
| 64 |
iptables -L INPUT -v -n -x >/dev/null 2>/dev/null |
|
| 64 |
iptables -L INPUT -v -n -x -w >/dev/null 2>/dev/null
|
|
| 65 | 65 |
if [ $? -gt 0 ]; then |
| 66 | 66 |
echo "no (could not run iptables as user `whoami`)" |
| 67 | 67 |
exit 1 |
| ... | ... | |
| 77 | 77 |
|
| 78 | 78 |
if [ "$1" = "suggest" ]; then |
| 79 | 79 |
# find Chains for Accounting |
| 80 |
iptables -L -n |grep ^ACCOUNTING |awk '{printf "%s\n%s\n",$4,$5}'| sort -u |sed 's#\/#-#'
|
|
| 80 |
iptables -L -n -w | grep ^ACCOUNTING |awk '{printf "%s\n%s\n",$4,$5}'| sort -u |sed 's#\/#-#'
|
|
| 81 | 81 |
exit 0 |
| 82 | 82 |
fi |
| 83 | 83 |
|
| ... | ... | |
| 99 | 99 |
exit 0 |
| 100 | 100 |
fi; |
| 101 | 101 |
|
| 102 |
echo "in.value $(( $(iptables -L -n -v -x |grep "ACCOUNTING" |awk '{printf "%s %s\n",$2,$9}' |grep $IP |awk '{printf "%s + ",$1}') 0 ))"
|
|
| 103 |
echo "out.value $(( $(iptables -L -n -v -x |grep "ACCOUNTING" |awk '{printf "%s %s\n",$2,$8}' |grep $IP |awk '{printf "%s + ",$1}') 0 ))"
|
|
| 102 |
echo "in.value $(( $(iptables -L -n -v -x -w | grep "ACCOUNTING" | awk '{printf "%s %s\n",$2,$9}' | grep $IP | awk '{printf "%s + ",$1}') 0 ))"
|
|
| 103 |
echo "out.value $(( $(iptables -L -n -v -x -w |grep "ACCOUNTING" | awk '{printf "%s %s\n",$2,$8}' | grep $IP | awk '{printf "%s + ",$1}') 0 ))"
|
|
| 104 | 104 |
|
Formats disponibles : Unified diff