From bb1beac5535920ba53ff3f3ab0066085891092f957320cf951f4da6b054c4c72 Mon Sep 17 00:00:00 2001 From: Ruediger Oertel Date: Thu, 5 Dec 2019 13:41:57 +0000 Subject: [PATCH] - check_iostat: allow to just specify a directory OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-sar-perf?expand=0&rev=18 --- check_iostat | 15 +++++++++++++++ monitoring-plugins-sar-perf.changes | 5 +++++ monitoring-plugins-sar-perf.spec | 4 ++-- usr.lib.nagios.plugins.check_iostat | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/check_iostat b/check_iostat index 91ed025..29de2f2 100644 --- a/check_iostat +++ b/check_iostat @@ -71,11 +71,26 @@ my ($crit_tps,$crit_read,$crit_written) = split(',',$critical); my ($warn_tps,$warn_read,$warn_written) = split(',',$warning); # Checking parameters: +if (-d "$disk") { + # directory specified ... + my $mp = `stat --format '\%m' $disk`; + chomp($mp); + open(MOUNTS,"/proc/mounts"); + while() { + chomp($_); + my @line = split('\s+',$_); + $disk = $line[0] if $mp eq $line[1]; + } + close(MOUNTS); +} + if (! -b "/dev/$disk") { if (-b "/dev/mapper/$disk") { my @f = stat("/dev/mapper/$disk"); $f[6] %= 256; $disk = "dm-$f[6]"; + } elsif (-b $disk) { + # take as is } else { warn "ERROR: Device incorrectly specified\n"; HELP_MESSAGE(); diff --git a/monitoring-plugins-sar-perf.changes b/monitoring-plugins-sar-perf.changes index 5c1b3df..1c1e701 100644 --- a/monitoring-plugins-sar-perf.changes +++ b/monitoring-plugins-sar-perf.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Dec 5 14:40:38 CET 2019 - ro@suse.de + +- check_iostat: allow to just specify a directory + ------------------------------------------------------------------- Sun Apr 14 16:06:32 UTC 2019 - Christian Boltz diff --git a/monitoring-plugins-sar-perf.spec b/monitoring-plugins-sar-perf.spec index 31f0c91..cd4ad79 100644 --- a/monitoring-plugins-sar-perf.spec +++ b/monitoring-plugins-sar-perf.spec @@ -1,7 +1,7 @@ # # spec file for package monitoring-plugins-sar-perf # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,7 +22,7 @@ License: BSD-2-Clause Group: System/Monitoring Version: 0.1 Release: 0 -Url: https://github.com/nickanderson/check-sar-perf +URL: https://github.com/nickanderson/check-sar-perf Source0: nickanderson-check-sar-perf-4878d0c.tar.gz Source1: check_iostat Source2: usr.lib.nagios.plugins.check_iostat diff --git a/usr.lib.nagios.plugins.check_iostat b/usr.lib.nagios.plugins.check_iostat index 90e587e..ba35d84 100644 --- a/usr.lib.nagios.plugins.check_iostat +++ b/usr.lib.nagios.plugins.check_iostat @@ -8,6 +8,7 @@ /usr/bin/which rix, /sys/devices/system/cpu/ r, /proc/meminfo r, + @{PROC}/[0-9]*/mounts r, /proc/diskstats r, /proc/uptime r, /etc/sysstat/sysstat.ioconf r,