mirror of
https://github.com/munin-monitoring/muninlite.git
synced 2024-12-22 13:52:13 +01:00
Plugin if_ and if_err_: use explicit variable for interface name
This commit is contained in:
parent
60b16f4121
commit
b5d8f7931b
2 changed files with 11 additions and 7 deletions
10
plugins/if_
10
plugins/if_
|
@ -1,6 +1,7 @@
|
|||
config_if() {
|
||||
INTERFACE=$1
|
||||
echo "graph_order down up"
|
||||
echo "graph_title $1 traffic"
|
||||
echo "graph_title $INTERFACE traffic"
|
||||
echo "graph_args --base 1000"
|
||||
echo "graph_vlabel bits in (-) / out (+) per \${graph_period}"
|
||||
echo "graph_category network"
|
||||
|
@ -17,8 +18,8 @@ config_if() {
|
|||
echo "up.cdef up,8,*"
|
||||
if [ -n "$(which ethtool)" ]; then
|
||||
if [ -x "$(which ethtool)" ]; then
|
||||
if ethtool "$1" | grep -q Speed; then
|
||||
MAX=$(($(ethtool "$1" | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d " " -f 2) * 1000000))
|
||||
if ethtool "$INTERFACE" | grep -q Speed; then
|
||||
MAX=$(($(ethtool "$INTERFACE" | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d " " -f 2) * 1000000))
|
||||
echo "up.max $MAX"
|
||||
echo "down.max $MAX"
|
||||
fi
|
||||
|
@ -26,7 +27,8 @@ config_if() {
|
|||
fi
|
||||
}
|
||||
fetch_if() {
|
||||
IINFO=$(grep "^ *$1:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
|
||||
INTERFACE=$1
|
||||
IINFO=$(grep "^ *$INTERFACE:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
|
||||
echo "down.value" "$(echo "$IINFO" | cut -d " " -f 1)"
|
||||
echo "up.value" "$(echo "$IINFO" | cut -d " " -f 9)"
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
config_if_err() {
|
||||
INTERFACE=$1
|
||||
echo "graph_order rcvd trans"
|
||||
echo "graph_title $1 errors"
|
||||
echo "graph_title $INTERFACE errors"
|
||||
echo "graph_args --base 1000"
|
||||
echo "graph_vlabel packets in (-) / out (+) per \${graph_period}"
|
||||
echo "graph_category network"
|
||||
echo "graph_info This graph shows the amount of errors on the $1 network interface."
|
||||
echo "graph_info This graph shows the amount of errors on the $INTERFACE network interface."
|
||||
echo "rcvd.label packets"
|
||||
echo "rcvd.type COUNTER"
|
||||
echo "rcvd.graph no"
|
||||
|
@ -15,7 +16,8 @@ config_if_err() {
|
|||
echo "trans.warning 1"
|
||||
}
|
||||
fetch_if_err() {
|
||||
IINFO=$(grep "^ *$1:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
|
||||
INTERFACE=$1
|
||||
IINFO=$(grep "^ *$INTERFACE:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
|
||||
echo "rcvd.value" "$(echo "$IINFO" | cut -d " " -f 3)"
|
||||
echo "trans.value" "$(echo "$IINFO" | cut -d " " -f 11)"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue