From: Caspar Schutijser Subject: Re: net/munin : add iostat plugin To: Olivier Cherrier Cc: Job Snijders , Kirill Bychkov , ports@openbsd.org Date: Thu, 29 Jan 2026 19:07:14 +0100 Hi, On Sun, Jan 25, 2026 at 02:12:23PM +0100, Olivier Cherrier wrote: > On 1/25/26 12:25 PM, Caspar Schutijser wrote: > > Hi, > > > > On Sat, Jan 24, 2026 at 07:05:26PM +0100, Olivier Cherrier wrote: > > > On 1/23/26 12:09 PM, Olivier Cherrier wrote: > > > > On 1/22/26 5:01 PM, Job Snijders wrote: > > > > > On Wed, 14 Jan 2026 at 16:31, Job Snijders > > > > > wrote: > > > > > > > > > > Anyway, I'm not sure we should keep both 'iostat_' and 'iostat' > > > > > around (since > > > > > they are intended do the same thing) > > > > > > > > > > > > > > > > > > > > How shall we proceed? > > > > > > > > > > Kind regards, > > > > > > > > > > Job > > >     Hi, > > > > > > Please find attached a patch to bump net/munin with the new iostat plugin. > > > Since new file, iostat is not in the diff. It needs to be cvs added manually > > > into "files". > > > iostat_ one can be delete from the tree. > > > > > > Is it ok ? > > > > > > Thanks, > > > Best. > > > > > > Olivier Cherrier > > > Phone: +352691570680 > > > mailto:oc@symacx.com > > > > > > Index: net/munin/Makefile > > > =================================================================== > > > RCS file: /data/repos/openbsd-cvs/ports/net/munin/Makefile,v > > > diff -u -r1.122 Makefile > > > --- net/munin/Makefile 17 Nov 2025 07:01:24 -0000 1.122 > > > +++ net/munin/Makefile 24 Jan 2026 17:57:07 -0000 > > > @@ -9,7 +9,7 @@ > > > PKGNAME-main = munin-node-${GH_TAGNAME} > > > PKGNAME-server =munin-server-${GH_TAGNAME} > > > CATEGORIES = net > > > -REVISION = 0 > > > +REVISION = 1 > > > HOMEPAGE = https://munin-monitoring.org/ > > > @@ -73,7 +73,7 @@ > > > DOCDIR=${WRKINST}/${PREFIX}/share/doc/munin \ > > > CONFDIR=${WRKINST}/${PREFIX}/share/examples/munin > > > -MUNIN_PLUGINS = bgpd if_pps_ intr iostat_ pf_changes pf_searches \ > > > +MUNIN_PLUGINS = bgpd if_pps_ intr iostat pf_changes pf_searches \ > > > pf_states sensors_ vmstat > > > .for i in ${MUNIN_PLUGINS} > > > @@ -86,7 +86,6 @@ > > > cp -p ${WRKSRC}/plugins/node.d.netbsd/memory.in ${WRKSRC}/plugins/node.d.openbsd > > > ${SUBST_CMD} -m 444 -c ${SUBST_LIST} > > > chmod -R +x ${WRKSRC}/plugins/node.d.openbsd > > > - rm ${WRKSRC}/plugins/node.d.openbsd/iostat.in # not yet ported > > > rm ${WRKSRC}/plugins/node.d.openbsd/swap.in # we have no in/out fields > > > # Fixup hardcoded paths in plugins to use TRUEPREFIX/LOCALBASE as appropriate, > > > Index: net/munin/pkg/PLIST-main > > > =================================================================== > > > RCS file: /data/repos/openbsd-cvs/ports/net/munin/pkg/PLIST-main,v > > > diff -u -r1.28 PLIST-main > > > --- net/munin/pkg/PLIST-main 17 Nov 2025 07:01:25 -0000 1.28 > > > +++ net/munin/pkg/PLIST-main 24 Jan 2026 17:57:07 -0000 > > > @@ -111,7 +111,7 @@ > > > libexec/munin/plugins/if_pps_ > > > libexec/munin/plugins/ifx_concurrent_sessions_ > > > libexec/munin/plugins/intr > > > -libexec/munin/plugins/iostat_ > > > +libexec/munin/plugins/iostat > > > @comment libexec/munin/plugins/ipac-ng > > > libexec/munin/plugins/ipmi_ > > > libexec/munin/plugins/ipmi_sensor_ > > > #!/bin/sh > > > # -*- sh -*- > > > # Copyright (c) 2026 Job Snijders > > > # > > > # Permission to use, copy, modify, and distribute this software for any > > > # purpose with or without fee is hereby granted, provided that the above > > > # copyright notice and this permission notice appear in all copies. > > > # > > > # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > > > # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > > > # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > > > # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > > > # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > > > # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > > > # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > # > > > # Munin multigraph plugin to monitor disk activity on OpenBSD systems. > > > # > > > # Magic markers: > > > # > > > #%# family=auto > > > #%# capabilities=autoconf > > > > > > if [ "$1" = "autoconf" ]; then > > > if [ -x /usr/sbin/iostat -a -x /sbin/sysctl ]; then > > > echo yes > > > exit 0 > > > else > > > echo no > > > exit 0 > > > fi > > > fi > > > > > > DISKS=$(/sbin/sysctl hw.disknames \ > > > | /usr/bin/cut -d= -f2 | /usr/bin/tr ',' '\n' \ > > > | /usr/bin/grep -v ':$' | /usr/bin/cut -d: -f1) > > Would it make sense to use "sysctl -n" and then remove the first use > > of "cut"? I can't think of a downside. > > > > Caspar > > > > Why not.  Not a big change. > New file attached. Thanks. I tested this and I looked at the diff, to me it looks good. OK caspar@ Below is a diff that includes the cvs add and cvs rm to make it easier to work with (no other changes). I'm putting kirby@, the maintainer of net/munin, on CC. kirby@, what do you think of this? Caspar -- Index: Makefile =================================================================== RCS file: /cvs/ports/net/munin/Makefile,v diff -u -p -r1.122 Makefile --- Makefile 17 Nov 2025 07:01:24 -0000 1.122 +++ Makefile 29 Jan 2026 18:00:14 -0000 @@ -9,7 +9,7 @@ GH_TAGNAME = 2.0.76 PKGNAME-main = munin-node-${GH_TAGNAME} PKGNAME-server =munin-server-${GH_TAGNAME} CATEGORIES = net -REVISION = 0 +REVISION = 1 HOMEPAGE = https://munin-monitoring.org/ @@ -73,7 +73,7 @@ FAKE_FLAGS += HTMLDIR=${WRKINST}/${PREF DOCDIR=${WRKINST}/${PREFIX}/share/doc/munin \ CONFDIR=${WRKINST}/${PREFIX}/share/examples/munin -MUNIN_PLUGINS = bgpd if_pps_ intr iostat_ pf_changes pf_searches \ +MUNIN_PLUGINS = bgpd if_pps_ intr iostat pf_changes pf_searches \ pf_states sensors_ vmstat .for i in ${MUNIN_PLUGINS} @@ -86,7 +86,6 @@ post-extract: cp -p ${WRKSRC}/plugins/node.d.netbsd/memory.in ${WRKSRC}/plugins/node.d.openbsd ${SUBST_CMD} -m 444 -c ${SUBST_LIST} chmod -R +x ${WRKSRC}/plugins/node.d.openbsd - rm ${WRKSRC}/plugins/node.d.openbsd/iostat.in # not yet ported rm ${WRKSRC}/plugins/node.d.openbsd/swap.in # we have no in/out fields # Fixup hardcoded paths in plugins to use TRUEPREFIX/LOCALBASE as appropriate, Index: files/iostat =================================================================== RCS file: files/iostat diff -N files/iostat --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/iostat 29 Jan 2026 18:00:14 -0000 @@ -0,0 +1,132 @@ +#!/bin/sh +# -*- sh -*- +# Copyright (c) 2026 Job Snijders +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Munin multigraph plugin to monitor disk activity on OpenBSD systems. +# +# Magic markers: +# +#%# family=auto +#%# capabilities=autoconf + +if [ "$1" = "autoconf" ]; then + if [ -x /usr/sbin/iostat -a -x /sbin/sysctl ]; then + echo yes + exit 0 + else + echo no + exit 0 + fi +fi + +DISKS=$(/sbin/sysctl -n hw.disknames \ + | /usr/bin/tr ',' '\n' | /usr/bin/grep -v ':$' | /usr/bin/cut -d: -f1) + +if [ "$1" = "config" ]; then + echo 'multigraph iostat_throughput' + echo 'graph_title Disk throughput per device' + echo 'graph_args --base 1024' + echo 'graph_vlabel Bytes/${graph_period}' + echo 'graph_category disk' + echo 'graph_info This graph shows averaged throughput in bytes per device.' + echo '' + + for DISK in ${DISKS}; do + echo "${DISK}_kb.label $DISK" + echo "${DISK}_kb.cdef ${DISK}_kb,1024,*" + echo "${DISK}_kb.type DERIVE" + echo "${DISK}_kb.min 0" + echo "${DISK}_kb.draw LINE1" + echo '' + done + + for DISK in ${DISKS}; do + echo "multigraph iostat_throughput.${DISK}" + echo "graph_title Disk throughput for ${DISK}" + echo 'graph_args --base 1024' + echo 'graph_category disk' + echo 'graph_info This graph shows disk throughput in bytes.' + echo '' + echo 'kb.label Bytes' + echo 'kb.cdef kb,1024,*' + echo 'kb.type DERIVE' + echo 'kb.min 0' + echo 'kb.draw LINE1' + echo '' + done + + echo 'multigraph iostat_iops' + echo 'graph_title Disk IOs per device' + echo 'graph_vlabel IOs/${graph_period}' + echo 'graph_args --base 1000' + echo 'graph_category disk' + echo 'graph_info This graph shows averaged IO operations per device.' + echo '' + + for DISK in ${DISKS}; do + echo "${DISK}_xfr.label ${DISK}" + echo "${DISK}_xfr.type DERIVE" + echo "${DISK}_xfr.min 0" + echo "${DISK}_xfr.draw LINE1" + echo '' + done + + for DISK in ${DISKS}; do + echo "multigraph iostat_iops.${DISK}" + echo "graph_title Disk IOs for ${DISK}" + echo 'graph_args --base 1000' + echo 'graph_category disk' + echo 'graph_info This graph shows the number of IOPS.' + echo '' + echo 'xfr.label IO/sec' + echo 'xfr.type DERIVE' + echo 'xfr.min 0' + echo 'xfr.draw LINE1' + echo '' + done + + # TODO: implement tracking IO busy as a percentage. + # To convert 'Seconds spent in disk activity' into a busy percentage, state + # tracking via $MUNIN_PLUGSTATE or $MUNIN_STATEFILE should be implemented. + # CDEF $cur,$prev,-,300,/,100,* + + exit 0 +fi + +echo 'multigraph iostat_throughput' +for DISK in $DISKS; do + echo -n "${DISK}_kb.value " + /usr/sbin/iostat -ID "${DISK}" | tail -1 | /usr/bin/awk '{ print $1 }' +done +echo '' + +echo 'multigraph iostat_iops' +for DISK in $DISKS; do + echo -n "${DISK}_xfr.value " + /usr/sbin/iostat -ID "${DISK}" | tail -1 | /usr/bin/awk '{ print $2 }' +done +echo '' + +for DISK in ${DISKS}; do + /usr/sbin/iostat -ID "${DISK}" | tail -1 | /usr/bin/awk ' + { + print "multigraph iostat_throughput.@DISK@"; + print "kb.value", $1; + print ""; + print "multigraph iostat_iops.@DISK@"; + print "xfr.value", $2; + print ""; + }' | /usr/bin/sed "s/@DISK@/${DISK}/" +done Index: files/iostat_ =================================================================== RCS file: files/iostat_ diff -N files/iostat_ --- files/iostat_ 17 Nov 2025 07:01:24 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,92 +0,0 @@ -#!/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: pkg/PLIST-main =================================================================== RCS file: /cvs/ports/net/munin/pkg/PLIST-main,v diff -u -p -r1.28 PLIST-main --- pkg/PLIST-main 17 Nov 2025 07:01:25 -0000 1.28 +++ pkg/PLIST-main 29 Jan 2026 18:00:14 -0000 @@ -111,7 +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_ +libexec/munin/plugins/iostat @comment libexec/munin/plugins/ipac-ng libexec/munin/plugins/ipmi_ libexec/munin/plugins/ipmi_sensor_