Browse Source

muninlite: correctly parse ifname with - char

Jonathan McCrohan: Squashed Fabio Capriati and Jo-Philipp Wich's patches.

Closes #701

Signed-off-by: Fabio Capriati <faxcpr@tiscali.it>
Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
Fabio Capriati 10 years ago
parent
commit
edcad492e1
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      admin/muninlite/patches/220-modify-ifname-parser.patch

+ 20
- 0
admin/muninlite/patches/220-modify-ifname-parser.patch View File

@@ -0,0 +1,20 @@
1
+--- a/munin-node.in
2
++++ b/munin-node.in
3
+@@ -141,7 +141,7 @@
4
+   fi
5
+ }
6
+ fetch_if() {
7
+-  IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/  / /g')
8
++  IINFO=$(sed -ne "/^ *${1//_/-}: / { s/^.\+: \+//; s/[[:space:]]\+/ /gp }" /proc/net/dev)
9
+   echo "down.value" $(echo $IINFO | cut -d\  -f1)
10
+   echo "up.value" $(echo $IINFO | cut -d\  -f9)
11
+ }
12
+@@ -162,7 +162,7 @@
13
+   echo "trans.warning 1"
14
+ }
15
+ fetch_if_err() {
16
+-  IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/  / /g')
17
++  IINFO=$(sed -ne "/^ *${1//_/-}: / { s/^.\+: \+//; s/[[:space:]]\+/ /gp }" /proc/net/dev)
18
+   echo "rcvd.value" $(echo $IINFO | cut -d\  -f3)
19
+   echo "trans.value" $(echo $IINFO | cut -d\  -f11)
20
+ }