From 44d1c8dc3aef0186bf6934fd1307133703f7916f Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sat, 8 Feb 2020 22:47:02 +0100 Subject: [PATCH] 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. --- plugins/if_ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/if_ b/plugins/if_ index 11b80c9..dc6b379 100644 --- a/plugins/if_ +++ b/plugins/if_ @@ -16,7 +16,7 @@ config_if() { echo "up.min 0" echo "up.negative down" 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)) echo "up.max $MAX" echo "down.max $MAX"