From: Olivier Cherrier Subject: net/munin : add interface description and iostat_ plugins To: OpenBSD ports Date: Tue, 11 Nov 2025 01:37:45 +0100     Hello, Here is a small bump for net/munin. It adds:   _ a description to the interface graphics (based on the 'descr' value     configured through ifconfig(8), if defined).     It is handy when you have many interfaces with similar names.   _ some 'iostat_' plugins to graph disk statistics (IO Bytes/s and transfers/s). Thanks, -- Olivier Cherrier Phone: +352691570680 mailto:oc@symacx.com #!/bin/sh # -*- sh -*- # # Wildcard-plugin to monitor disk IOs. To monitor a disk, link # iostat_ to this file. E.g. # # ln -s /usr/local/libexec/munin/plugins/iostat_ \ # /etc/munin/plugins/iostat_sd0 # # ...will monitor sd0. # # To aggregate all disk traffic on the system, link iostat_aggregated # to this file. # # Magic markers (optional - used by munin-config and some installation # scripts): # #%# family=auto #%# capabilities=autoconf suggest DISK=${0##*iostat_} if [ "$1" = "autoconf" ]; then if [ -x /usr/sbin/iostat -a -x /sbin/sysctl ]; then echo yes exit 0 else echo "no (/usr/sbin/iostat or /sbin/sysctl not found)" exit 0 fi fi if [ "$1" = "suggest" ]; then if [ -x /sbin/sysctl ]; then /sbin/sysctl hw.disknames | perl -ne ' my @disks = split(/=|,/); for my $disk (@disks) { next if $disk =~ m{hw.disknames}; my @d = split(/:/, $disk); print "$d[0]\n" if ($d[0] =~ m{[a-z]+\d+} and $d[1] =~ m/.{16}/); } ' exit 0 else exit 1 fi fi if [ "$1" = "config" ]; then echo 'multigraph bytes' echo "graph_title $DISK IO Bytes/s" echo 'graph_args --base 1024' echo 'graph_vlabel Bytes/s' echo 'graph_category disk' echo "graph_info This graph shows IO statistics (total Bytes/s) for $DISK disk." # echo 'graph_scale yes' echo "kb.info Data transfered (Bytes/s) on the $DISK disk." echo 'kb.label Bytes transfered' echo 'kb.type DERIVE' # echo 'kb.graph no' echo 'kb.cdef kb,1024,*' echo 'kb.min 0' echo '' echo 'multigraph xfr' echo "graph_title $DISK transfers/s" echo 'graph_args --base 1000' echo 'graph_vlabel xfr/s' echo 'graph_category disk' echo "graph_info This graph shows IO statistics (transfers/s) for $DISK disk." # echo 'graph_scale yes' echo "xfr.info Disk transfers (IOPs) on the $DISK disk." echo 'xfr.label Disk transfers' echo 'xfr.type DERIVE' # echo 'xfr.cdef xfr,8,*' echo 'xfr.min 0' exit 0 fi /usr/sbin/iostat -ID $DISK | awk ' /[[:digit:]]+[[:space:]][[:digit:]]+[[:space:]][[[:digit:]]|\.]+/ { if (NF == 3) { print "multigraph bytes"; print "kb.value", $1; print ""; print "multigraph xfr"; print "xfr.value", $2; } }' Index: plugins/node.d.openbsd/if_pps_.in --- plugins/node.d.openbsd/if_pps_.in.orig +++ plugins/node.d.openbsd/if_pps_.in @@ -31,6 +31,8 @@ if [ "$1" = "autoconf" ]; then fi fi +DESCR=$(/sbin/ifconfig ${INTERFACE} | /usr/bin/awk -F ': ' '/description:(.*)$/ {print substr($2, 1, 12);}') + if [ "$1" = "suggest" ]; then if [ -x /usr/bin/netstat ]; then netstat -i -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '//s/\** .*//p' @@ -42,7 +44,11 @@ fi if [ "$1" = "config" ]; then echo "graph_order rpkt opkt" - echo "graph_title $INTERFACE packets" + if [ "X${DESCR}" != 'X' ]; then + echo "graph_title $INTERFACE (${DESCR}) packets" + else + echo "graph_title $INTERFACE packets" + fi echo 'graph_args --base 1000' echo 'graph_vlabel packets/${graph_period} in (-) out (+)' echo 'graph_category network' Index: net/munin/Makefile =================================================================== RCS file: /data/repos/openbsd-cvs/ports/net/munin/Makefile,v diff -u -r1.121 Makefile --- net/munin/Makefile 23 May 2024 05:47:01 -0000 1.121 +++ net/munin/Makefile 11 Nov 2025 00:34:44 -0000 @@ -9,6 +9,7 @@ PKGNAME-main = munin-node-${GH_TAGNAME} PKGNAME-server =munin-server-${GH_TAGNAME} CATEGORIES = net +REVISION = 0 HOMEPAGE = https://munin-monitoring.org/ @@ -72,8 +73,8 @@ DOCDIR=${WRKINST}/${PREFIX}/share/doc/munin \ CONFDIR=${WRKINST}/${PREFIX}/share/examples/munin -MUNIN_PLUGINS = bgpd if_pps_ intr pf_changes pf_searches pf_states \ - sensors_ vmstat +MUNIN_PLUGINS = bgpd if_pps_ intr iostat_ pf_changes pf_searches \ + pf_states sensors_ vmstat .for i in ${MUNIN_PLUGINS} SUBST_LIST += ${FILESDIR}/$i ${WRKSRC}/plugins/node.d.openbsd/$i.in Index: net/munin/patches/patch-plugins_node_d_openbsd_if__in =================================================================== RCS file: /data/repos/openbsd-cvs/ports/net/munin/patches/patch-plugins_node_d_openbsd_if__in,v diff -u -r1.7 patch-plugins_node_d_openbsd_if__in --- net/munin/patches/patch-plugins_node_d_openbsd_if__in 11 Mar 2022 19:46:25 -0000 1.7 +++ net/munin/patches/patch-plugins_node_d_openbsd_if__in 11 Nov 2025 00:34:44 -0000 @@ -13,7 +13,15 @@ # # To aggregate all network interfaces on the system (except lo0), # link if_aggregated to this file. -@@ -37,7 +37,7 @@ if [ "$1" = "suggest" ]; then +@@ -31,13 +31,15 @@ if [ "$1" = "autoconf" ]; then + fi + fi + ++DESCR=$(/sbin/ifconfig ${INTERFACE} | /usr/bin/awk -F ': ' '/description:(.*)$/ {print substr($2, 1, 12);}') ++ + if [ "$1" = "suggest" ]; then + 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 @@ -22,7 +30,16 @@ exit 0 else exit 1 -@@ -51,7 +51,7 @@ if [ "$1" = "config" ]; then +@@ -47,11 +49,15 @@ fi + if [ "$1" = "config" ]; then + + echo "graph_order rbytes obytes" +- echo "graph_title $INTERFACE traffic" ++ if [ "X${DESCR}" != 'X' ]; then ++ echo "graph_title $INTERFACE (${DESCR}) traffic" ++ else ++ echo "graph_title $INTERFACE traffic" ++ fi echo 'graph_args --base 1000' echo 'graph_vlabel bits per ${graph_period} in (-) / out (+)' echo 'graph_category network' @@ -31,7 +48,7 @@ echo 'rbytes.label received' echo 'rbytes.type DERIVE' echo 'rbytes.graph no' -@@ -69,9 +69,11 @@ fi +@@ -69,9 +75,11 @@ fi if [ "$INTERFACE" = "aggregated" ]; then /usr/bin/netstat -i -b -n | grep -v '^lo' | awk ' BEGIN { rsum = 0; osum = 0; } @@ -46,7 +63,7 @@ } else if (NF == 11) { if ($4 ~ /:/) { rsum += $7; osum += $10; -@@ -79,7 +81,7 @@ BEGIN { rsum = 0; osum = 0; } +@@ -79,7 +87,7 @@ BEGIN { rsum = 0; osum = 0; } rsum += $7; osum += $10; } } else { # NF == 12 @@ -55,7 +72,7 @@ } } END { -@@ -89,17 +91,20 @@ END { +@@ -89,17 +97,20 @@ END { else /usr/bin/netstat -i -b -n -I $INTERFACE | awk ' Index: net/munin/patches/patch-plugins_node_d_openbsd_if_errcoll__in =================================================================== RCS file: /data/repos/openbsd-cvs/ports/net/munin/patches/patch-plugins_node_d_openbsd_if_errcoll__in,v diff -u -r1.5 patch-plugins_node_d_openbsd_if_errcoll__in --- net/munin/patches/patch-plugins_node_d_openbsd_if_errcoll__in 11 Mar 2022 19:46:25 -0000 1.5 +++ net/munin/patches/patch-plugins_node_d_openbsd_if_errcoll__in 11 Nov 2025 00:34:44 -0000 @@ -13,7 +13,15 @@ # # Any device found in /usr/bin/netstat can be monitored. # -@@ -34,7 +34,7 @@ if [ "$1" = "suggest" ]; then +@@ -28,13 +28,15 @@ if [ "$1" = "autoconf" ]; then + fi + fi + ++DESCR=$(/sbin/ifconfig ${INTERFACE} | /usr/bin/awk -F ': ' '/description:(.*)$/ {print substr($2, 1, 12);}') ++ + if [ "$1" = "suggest" ]; then + 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 @@ -22,7 +30,20 @@ exit 0 else exit 1 -@@ -57,25 +57,15 @@ if [ "$1" = "config" ]; then +@@ -43,7 +45,11 @@ fi + + if [ "$1" = "config" ]; then + echo "graph_order ierrors oerrors collisions" +- echo "graph_title $INTERFACE Errors & Collisions" ++ if [ "X${DESCR}" != 'X' ]; then ++ echo "graph_title $INTERFACE (${DESCR}) Errors & Collisions" ++ else ++ echo "graph_title $INTERFACE Errors & Collisions" ++ fi + echo 'graph_args --base 1000' + echo 'graph_vlabel events / ${graph_period}' + echo 'graph_category network' +@@ -57,25 +63,15 @@ if [ "$1" = "config" ]; then exit 0 fi; Index: net/munin/patches/patch-plugins_node_d_openbsd_if_packets__in =================================================================== RCS file: /data/repos/openbsd-cvs/ports/net/munin/patches/patch-plugins_node_d_openbsd_if_packets__in,v diff -u -r1.3 patch-plugins_node_d_openbsd_if_packets__in --- net/munin/patches/patch-plugins_node_d_openbsd_if_packets__in 11 Mar 2022 19:46:25 -0000 1.3 +++ net/munin/patches/patch-plugins_node_d_openbsd_if_packets__in 11 Nov 2025 00:34:44 -0000 @@ -1,7 +1,15 @@ Index: plugins/node.d.openbsd/if_packets_.in --- plugins/node.d.openbsd/if_packets_.in.orig +++ plugins/node.d.openbsd/if_packets_.in -@@ -37,7 +37,7 @@ if [ "$1" = "suggest" ]; then +@@ -31,13 +31,15 @@ if [ "$1" = "autoconf" ]; then + fi + fi + ++DESCR=$(/sbin/ifconfig ${INTERFACE} | /usr/bin/awk -F ': ' '/description:(.*)$/ {print substr($2, 1, 12);}') ++ + if [ "$1" = "suggest" ]; then + 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 @@ -10,7 +18,20 @@ exit 0 else exit 1 -@@ -69,9 +69,9 @@ fi +@@ -47,7 +49,11 @@ fi + if [ "$1" = "config" ]; then + + echo "graph_order rpackets opackets" +- echo "graph_title $INTERFACE pps" ++ if [ "X${DESCR}" != 'X' ]; then ++ echo "graph_title $INTERFACE (${DESCR}) pps" ++ else ++ echo "graph_title $INTERFACE pps" ++ fi + echo 'graph_args --base 1000' + echo 'graph_vlabel packets per ${graph_period} in (-) / out (+)' + echo 'graph_category network' +@@ -69,9 +75,9 @@ fi if [ "$INTERFACE" = "aggregated" ]; then /usr/bin/netstat -i -b -n | grep -v '^lo' | awk ' BEGIN { rsum = 0; osum = 0; } @@ -23,7 +44,7 @@ } else if (NF == 11) { if ($4 ~ /:/) { rsum += $5; osum += $8; -@@ -79,7 +79,7 @@ BEGIN { rsum = 0; osum = 0; } +@@ -79,7 +85,7 @@ BEGIN { rsum = 0; osum = 0; } rsum += $4; osum += $8; } } else { # NF == 12 @@ -32,7 +53,7 @@ } } END { -@@ -89,10 +89,10 @@ END { +@@ -89,10 +95,10 @@ END { else /usr/bin/netstat -i -b -n -I $INTERFACE | awk ' @@ -46,7 +67,7 @@ } else if (NF == 11) { if ($4 ~ /:/) { print "rpackets.value", $5; -@@ -103,7 +103,7 @@ else +@@ -103,7 +109,7 @@ else } } else { # NF == 12 print "rpackets.value", $5; Index: net/munin/pkg/PLIST-main =================================================================== RCS file: /data/repos/openbsd-cvs/ports/net/munin/pkg/PLIST-main,v diff -u -r1.27 PLIST-main --- net/munin/pkg/PLIST-main 8 Nov 2022 11:16:58 -0000 1.27 +++ net/munin/pkg/PLIST-main 11 Nov 2025 00:34:44 -0000 @@ -111,6 +111,7 @@ libexec/munin/plugins/if_pps_ libexec/munin/plugins/ifx_concurrent_sessions_ libexec/munin/plugins/intr +libexec/munin/plugins/iostat_ @comment libexec/munin/plugins/ipac-ng libexec/munin/plugins/ipmi_ libexec/munin/plugins/ipmi_sensor_