From edcad492e115e012366b41350e9cd3032bda832e Mon Sep 17 00:00:00 2001 From: Fabio Capriati Date: Mon, 29 Dec 2014 10:11:44 +0100 Subject: [PATCH] muninlite: correctly parse ifname with - char Jonathan McCrohan: Squashed Fabio Capriati and Jo-Philipp Wich's patches. Closes #701 Signed-off-by: Fabio Capriati Signed-off-by: Jonathan McCrohan --- .../patches/220-modify-ifname-parser.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 admin/muninlite/patches/220-modify-ifname-parser.patch diff --git a/admin/muninlite/patches/220-modify-ifname-parser.patch b/admin/muninlite/patches/220-modify-ifname-parser.patch new file mode 100644 index 000000000..17345ee0f --- /dev/null +++ b/admin/muninlite/patches/220-modify-ifname-parser.patch @@ -0,0 +1,20 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -141,7 +141,7 @@ + fi + } + fetch_if() { +- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g') ++ IINFO=$(sed -ne "/^ *${1//_/-}: / { s/^.\+: \+//; s/[[:space:]]\+/ /gp }" /proc/net/dev) + echo "down.value" $(echo $IINFO | cut -d\ -f1) + echo "up.value" $(echo $IINFO | cut -d\ -f9) + } +@@ -162,7 +162,7 @@ + echo "trans.warning 1" + } + fetch_if_err() { +- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g') ++ IINFO=$(sed -ne "/^ *${1//_/-}: / { s/^.\+: \+//; s/[[:space:]]\+/ /gp }" /proc/net/dev) + echo "rcvd.value" $(echo $IINFO | cut -d\ -f3) + echo "trans.value" $(echo $IINFO | cut -d\ -f11) + }