--- plugins/node.d.freebsd/if_.in.orig 2014-10-26 14:12:24 UTC +++ plugins/node.d.freebsd/if_.in @@ -22,7 +22,7 @@ INTERFACE=${0##*if_} if [ "$1" = "autoconf" ]; then - if [ -x /usr/bin/netstat ]; then + if [ -x /sbin/ifconfig -o -x /usr/bin/netstat ]; then echo yes exit 0 else @@ -32,8 +32,12 @@ fi if [ "$1" = "suggest" ]; then - if [ -x /usr/bin/netstat ]; then - netstat -i -b -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '//s/\** .*//p' + if [ -x /sbin/ifconfig ] + then + ifconfig -l | sed -Ee 's/[[:<:]](pfsync|faith|pf(log|sync)|lo|plip|carp|enc|fwe)[^ ]*//g' | xargs -n 1 echo + exit 0 + elif [ -x /usr/bin/netstat ]; then + netstat -i -b -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pf(log|sync)/d' -e '//s/\** .*//p' exit 0 else exit 1 @@ -68,8 +72,10 @@ // { if (NF == 10) { rsum += $6; osum += $9; - } else { + } else if (NF == 11) { rsum += $7; osum += $10; + } else { # NF == 12 + rsum += $8; osum += $11; } } END { @@ -83,9 +89,13 @@ if (NF == 10) { print "rbytes.value", $6; print "obytes.value", $9; - } else { + } else if (NF == 11) { print "rbytes.value", $7; print "obytes.value", $10; + } else { # NF == 12 + print "rbytes.value", $8; + print "obytes.value", $11; } }' fi +