1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| my @msg;
my $i=0;
# Boucle de tests des seuils
my $state = -1;
foreach my $id (sort keys (%infos_hash)) {
if ($infos_hash{$id}->[4] >= $crit_level){
$msg[$i]="Swap $id = $infos_hash{$id}->[4]";
$state = 2;
}
elsif ($infos_hash{$id}->[4] >= $warn_level){
$msg[$i]="Swap $id = $infos_hash{$id}->[4]";
$state = 1 if $state < $exit_codes{'WARNING'};
}
elsif ($infos_hash{$id}->[4]){
$msg[$i]="Swap $id = $infos_hash{$id}->[4]";
$state = 0 if $state < $exit_codes{'OK'};
}
else {
print "Swap UNKNOWN - Seems to be undefinied, please verify check_multiswap\n";
}
$i++;
}
# Sortie du resultat
print join ' -- ',@msg;
print " - (w:$warn_level/c:$crit_level used)\n";
exit $exit_codes{$state}; |