Plugin if_: do not expose errors from ethtool

ethtool prints the error message "Cannot get device settings: No such
device" for VLAN devices.  This error message should not be exposed via
the munin protocol.
This commit is contained in:
Lars Kruse 2020-02-08 22:47:02 +01:00
parent 9cca1e479a
commit 44d1c8dc3a

View file

@ -16,7 +16,7 @@ config_if() {
echo "up.min 0" echo "up.min 0"
echo "up.negative down" echo "up.negative down"
echo "up.cdef up,8,*" echo "up.cdef up,8,*"
if [ -n "$(which ethtool)" ] && [ -x "$(which ethtool)" ] && ethtool "$INTERFACE" | grep -q Speed; then if [ -n "$(which ethtool)" ] && [ -x "$(which ethtool)" ] && ethtool "$INTERFACE" 2>/dev/null | 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)) 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 "up.max $MAX"
echo "down.max $MAX" echo "down.max $MAX"