Index | Thread | Search

From:
"Kirill Bychkov" <kirby@linklevel.net>
Subject:
Re: net/munin : add interface description and iostat_ plugins
To:
"Olivier Cherrier" <oc@symacx.com>, "OpenBSD ports" <ports@openbsd.org>, "Kirill Bychkov" <kirby@openbsd.org>
Date:
Tue, 11 Nov 2025 17:59:57 +0300

Download raw body.

Thread
On Tue, November 11, 2025 16:56, Stuart Henderson wrote:
> On 2025/11/11 13:46, Stuart Henderson wrote:
>> On 2025/11/11 13:55, Olivier Cherrier wrote:
>> > Sorry for this.  Here it is.
>>
>> no worries at all, it just makes it easier (which generally makes it
>> more likely to get handled sooner ;)
>>
>> will check/commit.
>
> oh oops, I forgot this has a maintainer. cc'ing kirby@. diff updated
> with minor whitespace nits.

Hi!
Will check this in a couple of days. Looks good at first glance.

>
>> > > > 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).
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/net/munin/Makefile,v
> diff -u -p -r1.121 Makefile
> --- Makefile	23 May 2024 05:47:01 -0000	1.121
> +++ Makefile	11 Nov 2025 13:56:13 -0000
> @@ -1,14 +1,15 @@
> -PORTROACH = 	limitw:1,even
> +PORTROACH =	limitw:1,even
>
>  COMMENT-main =	flexible network host monitoring, client
>  COMMENT-server =flexible network host monitoring, server
>
> -GH_ACCOUNT = 	munin-monitoring
> -GH_PROJECT = 	munin
> +GH_ACCOUNT =	munin-monitoring
> +GH_PROJECT =	munin
>  GH_TAGNAME =	2.0.76
>  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 @@ FAKE_FLAGS +=		HTMLDIR=${WRKINST}/${PREF
>  			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: files/iostat_
> ===================================================================
> RCS file: files/iostat_
> diff -N files/iostat_
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ files/iostat_	11 Nov 2025 13:56:13 -0000
> @@ -0,0 +1,92 @@
> +#!/bin/sh
> +# -*- sh -*-
> +#
> +# Wildcard-plugin to monitor disk IOs. To monitor a disk, link
> +# iostat_<disk> 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: patches/patch-plugins_node_d_openbsd_if__in
> ===================================================================
> RCS file: /cvs/ports/net/munin/patches/patch-plugins_node_d_openbsd_if__in,v
> diff -u -p -r1.7 patch-plugins_node_d_openbsd_if__in
> --- patches/patch-plugins_node_d_openbsd_if__in	11 Mar 2022 19:46:25 -0000	1.7
> +++ patches/patch-plugins_node_d_openbsd_if__in	11 Nov 2025 13:56:13 -0000
> @@ -13,7 +13,15 @@ Index: plugins/node.d.openbsd/if_.in
>   #
>   # 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 @@ Index: plugins/node.d.openbsd/if_.in
>   		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 @@ Index: plugins/node.d.openbsd/if_.in
>   	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 @@ Index: plugins/node.d.openbsd/if_.in
>   	} 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 @@ Index: plugins/node.d.openbsd/if_.in
>   	}
>   }
>   END {
> -@@ -89,17 +91,20 @@ END {
> +@@ -89,17 +97,20 @@ END {
>
>   else
>   	/usr/bin/netstat -i -b -n -I $INTERFACE | awk '
> Index: patches/patch-plugins_node_d_openbsd_if_errcoll__in
> ===================================================================
> RCS file:
> /cvs/ports/net/munin/patches/patch-plugins_node_d_openbsd_if_errcoll__in,v
> diff -u -p -r1.5 patch-plugins_node_d_openbsd_if_errcoll__in
> --- patches/patch-plugins_node_d_openbsd_if_errcoll__in	11 Mar 2022 19:46:25
> -0000	1.5
> +++ patches/patch-plugins_node_d_openbsd_if_errcoll__in	11 Nov 2025 13:56:13
> -0000
> @@ -13,7 +13,15 @@ Index: plugins/node.d.openbsd/if_errcoll
>   #
>   # 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 @@ Index: plugins/node.d.openbsd/if_errcoll
>   		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: patches/patch-plugins_node_d_openbsd_if_packets__in
> ===================================================================
> RCS file:
> /cvs/ports/net/munin/patches/patch-plugins_node_d_openbsd_if_packets__in,v
> diff -u -p -r1.3 patch-plugins_node_d_openbsd_if_packets__in
> --- patches/patch-plugins_node_d_openbsd_if_packets__in	11 Mar 2022 19:46:25
> -0000	1.3
> +++ patches/patch-plugins_node_d_openbsd_if_packets__in	11 Nov 2025 13:56:13
> -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 @@ Index: plugins/node.d.openbsd/if_packets
>   		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 @@ Index: plugins/node.d.openbsd/if_packets
>   	} 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 @@ Index: plugins/node.d.openbsd/if_packets
>   	}
>   }
>   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 @@ Index: plugins/node.d.openbsd/if_packets
>   	} 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: patches/patch-plugins_node_d_openbsd_if_pps__in
> ===================================================================
> RCS file: patches/patch-plugins_node_d_openbsd_if_pps__in
> diff -N patches/patch-plugins_node_d_openbsd_if_pps__in
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-plugins_node_d_openbsd_if_pps__in	11 Nov 2025 13:56:13 -0000
> @@ -0,0 +1,25 @@
> +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
> '/<Link>/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: pkg/PLIST-main
> ===================================================================
> RCS file: /cvs/ports/net/munin/pkg/PLIST-main,v
> diff -u -p -r1.27 PLIST-main
> --- pkg/PLIST-main	8 Nov 2022 11:16:58 -0000	1.27
> +++ pkg/PLIST-main	11 Nov 2025 13:56:13 -0000
> @@ -111,6 +111,7 @@ libexec/munin/plugins/if_packets_
>  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_
>