Browse Source

muninlite: Fix fetching data for interfaces with a dash in the name

munin-node passes the original interface name (as extracted from
/proc/net/dev) to if_* and if_err_*. Thus replacing dash with underscore
results in interfaces not being found anymore.

Closes: #1927

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
lilik-openwrt-22.03
Martin Blumenstingl 9 years ago
committed by Jonathan McCrohan
parent
commit
d7b9595482
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      admin/muninlite/Makefile
  2. +2
    -2
      admin/muninlite/patches/220-modify-ifname-parser.patch

+ 1
- 1
admin/muninlite/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=muninlite
PKG_VERSION:=1.0.4
PKG_RELEASE:=7
PKG_RELEASE:=8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/$(PKG_NAME)


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

@ -5,7 +5,7 @@
}
fetch_if() {
- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
+ IINFO=$(cat /proc/net/dev | sed -e 's/-/_/g' | grep "$1:" | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
+ IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
echo "down.value" $(echo $IINFO | cut -d\ -f1)
echo "up.value" $(echo $IINFO | cut -d\ -f9)
}
@ -16,7 +16,7 @@
}
fetch_if_err() {
- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
+ IINFO=$(cat /proc/net/dev | sed -e 's/-/_/g' | grep "$1:" | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
+ IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
echo "rcvd.value" $(echo $IINFO | cut -d\ -f3)
echo "trans.value" $(echo $IINFO | cut -d\ -f11)
}

Loading…
Cancel
Save