$OpenBSD: patch-plugins_node_d_openbsd_if_errcoll__in,v 1.4 2018/05/15 05:48:32 florian Exp $
Index: plugins/node.d.openbsd/if_errcoll_.in
--- plugins/node.d.openbsd/if_errcoll_.in.orig
+++ plugins/node.d.openbsd/if_errcoll_.in
@@ -4,9 +4,9 @@
 # Wildcard-plugin to monitor network interfaces. To monitor an
 # interface, link if_<interface> to this file. E.g.
 #
-#    ln -s /usr/share/munin/node/plugins-auto/if_ /etc/munin/node.d/if_eth0
+#    ln -s /usr/share/munin/node/plugins-auto/if_errcoll_ /etc/munin/node.d/if_errcoll_em0
 #
-# ...will monitor eth0.
+# ...will monitor em0.
 #
 # Any device found in /usr/bin/netstat can be monitored.
 #
@@ -34,7 +34,7 @@ if [ "$1" = "suggest" ]; 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 '/<Link#[0-9]*>/s/\** .*//p'
+		netstat -i -b -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pf(log|sync)/d' -e '/<Link>/s/\** .*//p'
 		exit 0
 	else
 		exit 1
@@ -57,25 +57,15 @@ if [ "$1" = "config" ]; then
 	exit 0
 fi;
 
-/usr/bin/netstat -i -b -n -I $INTERFACE | awk '
-/<Link#[0-9]*>/ {
-	if (NF == 10) {
+/usr/bin/netstat -i -n -I $INTERFACE | awk '
+/<Link>/ {
+	if (NF == 8) {
 		print "ierrors.value", $5;
-		print "oerrors.value", $8;
-		print "collisions.value", $10;
-	} else if (NF == 11) {
-		if ($4 ~ /:/) {
-			print "ierrors.value", $6;
-			print "oerrors.value", $9;
-			print "collisions.value", $11;
-		} else {
-			print "ierrors.value", $5;
-			print "oerrors.value", $9;
-			print "collisions.value", $11;
-		}
-	} else { # NF == 12
+		print "oerrors.value", $7;
+		print "collisions.value", $8;
+	} else {
 		print "ierrors.value", $6;
-		print "oerrors.value", $10;
-		print "collisions.value", $12;
+		print "oerrors.value", $8;
+		print "collisions.value", $9;
 	}
 }'
