From 1f718b7799233ec1126d150e5d7fd0f945ae6a2f5b254636044e9d5d3c85f6d8 Mon Sep 17 00:00:00 2001 From: Ruediger Oertel Date: Tue, 10 Mar 2020 13:42:07 +0000 Subject: [PATCH] fix last change OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-sar-perf?expand=0&rev=24 --- check_iostat | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/check_iostat b/check_iostat index 106f8ca..1b88c98 100644 --- a/check_iostat +++ b/check_iostat @@ -171,46 +171,46 @@ close (IOSTAT); my $msg = "OK"; my $status = 0; -my @reasons; +my %reasons; # Comparing the result and setting the correct level: if ($tps >= $warn_tps || $kbread >= $warn_read || $kbwritten >= $warn_written) { $msg = "WARNING"; - push @reasons, "throughput"; + $reasons{'throughput'} = 1; $status = 1; } if ($warn_iowait && $iowait >= $warn_iowait) { $msg = "WARNING"; - push @reasons, "iowait"; + $reasons{'iowait'} = 1; $status = 1; } if ($warn_util && $util >= $warn_util) { $msg = "WARNING"; - push @reasons, "util"; + $reasons{'util'} = 1; $status = 1; } if ($tps >= $crit_tps || $kbread >= $crit_read || $kbwritten >= $crit_written) { $msg = "CRITICAL"; - push @reasons, "throughput"; + $reasons{'throughput'} = 2; $status = 2; } if ($crit_iowait && $iowait >= $crit_iowait) { $msg = "CRITICAL"; - push @reasons, "iowait"; + $reasons{'iowait'} = 2; $status = 2; } if ($crit_util && $util >= $crit_util) { $msg = "CRITICAL"; - push @reasons, "util"; + $reasons{'util'} = 2; $status = 2; } -$msg .= " (".join(",",@reasons).")"; +$msg .= " (".join(",",keys(%reasons)).")" if $status != 0; my $p_tps = $tps; if ($warn_tps) {