diff --git a/Build.PL b/Build.PL index a7571cba56..14fa5cd161 100755 --- a/Build.PL +++ b/Build.PL @@ -236,8 +236,11 @@ if ( not $build->install_path('plugins') ) { $plugins_files->{'plugins/plugin.sh'} = 'plugins/plugin.sh'; +# MidnightBSD is similar to FreeBSD, so we also want to include FreeBSD specific plugins here. +my $os = $^O; +$os =~ s/midnightbsd/freebsd/; File::Find::find( { wanted => \&_find_plugins_wanted }, - 'plugins/node.d', "plugins/node.d.$^O" ); + 'plugins/node.d', "plugins/node.d.$os" ); sub _find_plugins_wanted { diff --git a/doc/installation/install.rst b/doc/installation/install.rst index 2b251cd7ba..2e5c4f8baa 100644 --- a/doc/installation/install.rst +++ b/doc/installation/install.rst @@ -100,6 +100,23 @@ You will have to enable the services in systemd to get them up and running. Likely you will have to fix SELinux issues when using 3rd-Party plugins and SELinux active and set to *enforcing mode* on the Munin node. In case you get competent and friendly support on `SELinux mailinglist `_. +MidnightBSD +------- + +From source: + +.. code-block:: bash + + cd /usr/mports/sysutils/munin-master && make install clean + cd /usr/mports/sysutils/munin-node && make install clean + +Binary packages: + +.. code-block:: bash + + mport install munin-master + mport install munin-node + Other systems ------------- diff --git a/plugins/node.d.freebsd/cpu b/plugins/node.d.freebsd/cpu index e204b88a78..1d9dd56834 100755 --- a/plugins/node.d.freebsd/cpu +++ b/plugins/node.d.freebsd/cpu @@ -34,12 +34,11 @@ if [ "$1" = "autoconf" ]; then fi if [ "$1" = "config" ]; then - OSV=`$SYSCTL_BIN -n kern.osrelease | cut -f1 -d.` - if [ "$OSV" = "4" ]; then - STATUNITS=`$SYSCTL_BIN -n kern.clockrate | cut -f16 -d' '` - elif [ "$OSV" -ge "5" ]; then + if [ "$(uname -s)" = "MidnightBSD" ] || [ "$OSV" -ge "5" ]; then STATUNITS=`$SYSCTL_BIN -n kern.clockrate | cut -f13 -d' '` + elif [ "$OSV" = "4" ]; then + STATUNITS=`$SYSCTL_BIN -n kern.clockrate | cut -f16 -d' '` fi PERCENT=`$SYSCTL_BIN -n hw.ncpu | awk '{print ($1)*100}'` NCPU=`$SYSCTL_BIN -n hw.ncpu` diff --git a/plugins/node.d.freebsd/systat b/plugins/node.d.freebsd/systat index f1c1137d66..1e70afd1e4 100755 --- a/plugins/node.d.freebsd/systat +++ b/plugins/node.d.freebsd/systat @@ -50,7 +50,7 @@ EOF exit 0 fi ostype=`uname -s` - if [ ${ostype} = "FreeBSD" ]; then + if [ ${ostype} = "FreeBSD" ] || [ ${ostype} = "MidnightBSD" ]; then echo "yes" exit 0 fi diff --git a/plugins/node.d.freebsd/vmstat b/plugins/node.d.freebsd/vmstat index 572ed243e7..e855106b92 100755 --- a/plugins/node.d.freebsd/vmstat +++ b/plugins/node.d.freebsd/vmstat @@ -20,7 +20,7 @@ OSV=`/sbin/sysctl -n kern.osrelease | cut -f1 -d.` if [ "$1" = "autoconf" ]; then - if [ "$OSV" -ge "5" ]; then + if [ $(uname -s) = "MidnightBSD" ] || [ "$OSV" -ge "5" ]; then /sbin/sysctl -n vm.vmtotal 2>/dev/null >/dev/null RESULT=$? NAME=/sbin/sysctl @@ -49,7 +49,7 @@ if [ "$1" = "config" ]; then echo 'graph_vlabel process states' echo 'graph_category processes' echo 'graph_info This graph shows number of processes in each state.' - if [ "$OSV" -ge "5" ]; then + if [ $(uname -s) = "MidnightBSD" ] || [ "$OSV" -ge "5" ]; then echo 'running.label running' echo 'running.info processes on CPU or waiting for CPU' echo 'running.type GAUGE' @@ -71,7 +71,7 @@ if [ "$1" = "config" ]; then exit 0 fi -if [ "$OSV" -ge "5" ]; then +if [ $(uname -s) = "MidnightBSD" ] || [ "$OSV" -ge "5" ]; then /sbin/sysctl -n vm.vmtotal | /usr/bin/awk ' /^Processes:/ { print "running.value", $3; diff --git a/plugins/node.d/hddtemp_smartctl b/plugins/node.d/hddtemp_smartctl index 3518eca350..dd185145eb 100755 --- a/plugins/node.d/hddtemp_smartctl +++ b/plugins/node.d/hddtemp_smartctl @@ -183,7 +183,7 @@ if ($^O eq 'linux') { # Get list of all drives we found @drives=(@drivesIDE,@drivesSCSI,@drivesNVME); -} elsif ($^O eq 'freebsd') { +} elsif (($^O eq 'freebsd') || ($^O eq 'midnightbsd')) { opendir(DEV, '/dev'); @drives = grep /^(ada?|da)[0-9]+$/, readdir DEV; closedir(DEV); diff --git a/plugins/node.d/processes b/plugins/node.d/processes index d8b8fc6eda..95cac2c594 100755 --- a/plugins/node.d/processes +++ b/plugins/node.d/processes @@ -72,7 +72,7 @@ OPERSYS=${OPERSYS:-$(uname | cut -f 1 -d _)} if [ "$1" = "autoconf" ]; then case "$OPERSYS" in - Linux|SunOS|FreeBSD|OpenBSD|NetBSD|Darwin|CYGWIN) + Linux|SunOS|FreeBSD|OpenBSD|NetBSD|Darwin|CYGWIN|MidnightBSD) if ! "$ps" >/dev/null 2>/dev/null; then echo "no (ps=$ps failed)" elif ! echo | "$awk" '{ print "Hei" }' >/dev/null 2>/dev/null; then @@ -227,11 +227,25 @@ if [ "$1" = "config" ]; then echo "nonexistent.info The number of nonexistent processes." print_warning nonexistent print_critical nonexistent + elif [ "$OPERSYS" = "MidnightBSD" ]; then + echo "graph_order sleeping idle stopped zombie lock uninterruptible interrupt runnable processes" + echo "lock.label lock" + echo "lock.draw STACK" + echo "lock.colour $LOCK" + echo "lock.info The number of processes that are waiting to acquire a lock." + print_warning lock + print_critical lock + echo "interrupt.label interrupt" + echo "interrupt.draw STACK" + echo "interrupt.colour $INTERRUPT" + echo "interrupt.info The number of idle interrupt threads." + print_warning interrupt + print_critical interrupt fi # Common flags for some OS if [ "$OPERSYS" = "FreeBSD" ] || [ "$OPERSYS" = "OpenBSD" ] || - [ "$OPERSYS" = "NetBSD" ] || [ "$OPERSYS" = "Darwin" ]; then + [ "$OPERSYS" = "NetBSD" ] || [ "$OPERSYS" = "Darwin" ] || [ "$OPERSYS" = "MidnightBSD" ]; then echo "idle.label idle" echo "idle.draw STACK" echo "idle.colour $IDLE" @@ -267,7 +281,7 @@ if [ "$1" = "config" ]; then fi if [ "$OPERSYS" = "Linux" ] || [ "$OPERSYS" = "FreeBSD" ] || - [ "$OPERSYS" = "OpenBSD" ] || [ "$OPERSYS" = "NetBSD" ]; then + [ "$OPERSYS" = "OpenBSD" ] || [ "$OPERSYS" = "NetBSD" ] || [ "$OPERSYS" = "MidnightBSD" ]; then echo "uninterruptible.label uninterruptible" echo "uninterruptible.draw STACK" echo "uninterruptible.colour $UNINTERRUPTIBLE" @@ -344,7 +358,7 @@ print "runnable.value " 0+stat["R"]; print "stopped.value " 0+stat["T"]; print "zombie.value " 0+stat["Z"]; }' -elif [ "$OPERSYS" = "FreeBSD" ]; then +elif [ "$OPERSYS" = "FreeBSD" ] || [ "$OPERSYS" = "MidnightBSD" ]; then # shellcheck disable=SC2016 "$ps" -axo state= | sed -e 's/^\(.\).*/\1/' | "$awk" ' { processes++; stat[$1]++ } diff --git a/plugins/node.d/smart_ b/plugins/node.d/smart_ index 2d29b4d0f2..1a0002ae01 100755 --- a/plugins/node.d/smart_ +++ b/plugins/node.d/smart_ @@ -572,7 +572,7 @@ def find_smart_drives(): continue except Exception as exc: verboselog('Failed to list OpenBSD disks: {}'.format(exc)) - elif os.uname()[0] == "FreeBSD": + elif os.uname()[0] in {"FreeBSD", "MidnightBSD"}: try: sysctl_kerndisks = os.popen('sysctl kern.disks') kerndisks = sysctl_kerndisks.readline().strip() @@ -588,7 +588,7 @@ def find_smart_drives(): except Exception: continue except Exception as exc: - verboselog('Failed to list FreeBSD disks: {}'.format(exc)) + verboselog('Failed to list {} disks: {}'.format(os.uname()[0], exc)) elif os.uname()[0] == "Darwin": try: from glob import glob