Ruediger Oertel 2020-03-10 13:42:07 +00:00 committed by Git OBS Bridge
parent 2be02b9d41
commit 1f718b7799

View File

@ -171,46 +171,46 @@ close (IOSTAT);
my $msg = "OK"; my $msg = "OK";
my $status = 0; my $status = 0;
my @reasons; my %reasons;
# Comparing the result and setting the correct level: # Comparing the result and setting the correct level:
if ($tps >= $warn_tps || $kbread >= $warn_read || $kbwritten >= $warn_written) { if ($tps >= $warn_tps || $kbread >= $warn_read || $kbwritten >= $warn_written) {
$msg = "WARNING"; $msg = "WARNING";
push @reasons, "throughput"; $reasons{'throughput'} = 1;
$status = 1; $status = 1;
} }
if ($warn_iowait && $iowait >= $warn_iowait) { if ($warn_iowait && $iowait >= $warn_iowait) {
$msg = "WARNING"; $msg = "WARNING";
push @reasons, "iowait"; $reasons{'iowait'} = 1;
$status = 1; $status = 1;
} }
if ($warn_util && $util >= $warn_util) { if ($warn_util && $util >= $warn_util) {
$msg = "WARNING"; $msg = "WARNING";
push @reasons, "util"; $reasons{'util'} = 1;
$status = 1; $status = 1;
} }
if ($tps >= $crit_tps || $kbread >= $crit_read || $kbwritten >= $crit_written) { if ($tps >= $crit_tps || $kbread >= $crit_read || $kbwritten >= $crit_written) {
$msg = "CRITICAL"; $msg = "CRITICAL";
push @reasons, "throughput"; $reasons{'throughput'} = 2;
$status = 2; $status = 2;
} }
if ($crit_iowait && $iowait >= $crit_iowait) { if ($crit_iowait && $iowait >= $crit_iowait) {
$msg = "CRITICAL"; $msg = "CRITICAL";
push @reasons, "iowait"; $reasons{'iowait'} = 2;
$status = 2; $status = 2;
} }
if ($crit_util && $util >= $crit_util) { if ($crit_util && $util >= $crit_util) {
$msg = "CRITICAL"; $msg = "CRITICAL";
push @reasons, "util"; $reasons{'util'} = 2;
$status = 2; $status = 2;
} }
$msg .= " (".join(",",@reasons).")"; $msg .= " (".join(",",keys(%reasons)).")" if $status != 0;
my $p_tps = $tps; my $p_tps = $tps;
if ($warn_tps) { if ($warn_tps) {