- 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
This commit is contained in:
Ruediger Oertel 2019-12-05 13:41:57 +00:00 committed by Git OBS Bridge
parent 5bd64f92b0
commit bb1beac553
4 changed files with 23 additions and 2 deletions

View File

@ -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(<MOUNTS>) {
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();

View File

@ -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 <suse-beta@cboltz.de>

View File

@ -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

View File

@ -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,