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.

Source: patch "220-modify-ifname-parser" from OpenWrt
Author: Martin Blumenstingl
This commit is contained in:
Lars Kruse 2019-07-19 06:01:08 +02:00
parent f906a5f4da
commit 7b4f376daf
2 changed files with 2 additions and 2 deletions

View file

@ -26,7 +26,7 @@ config_if() {
fi
}
fetch_if() {
IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
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)
}

View file

@ -15,7 +15,7 @@ config_if_err() {
echo "trans.warning 1"
}
fetch_if_err() {
IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
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)
}