summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bfe20df)
raw | patch | inline | side by side (parent: bfe20df)
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | |
Wed, 6 Oct 2010 03:19:03 +0000 (23:19 -0400) | ||
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | |
Wed, 6 Oct 2010 03:19:03 +0000 (23:19 -0400) |
contrib/check_linux_raid.pl | patch | blob | history |
index d2e5b4632d4b2b5631f38e45605388a74886efc1..77e75f6d0aa787890944d0a6a1bc19b219689c0b 100644 (file)
} elsif (/^($nextdev)\s*:/) {
$device=$1;
$devices{$device}=$device;
- if (/active/) {
+ if (/\sactive/) {
+ $status{$device} = ''; # Shall be filled later if available
$active{$device} = 1;
}
}
}
foreach my $k (sort keys %devices){
- if ($status{$k} =~ /_/) {
+ if (!exists($status{$k})) {
+ $msg .= sprintf " %s inactive with no status information.",
+ $devices{$k};
+ $code = max_state($code, "CRITICAL");
+ } elsif ($status{$k} =~ /_/) {
if (defined $recovery{$k}) {
$msg .= sprintf " %s status=%s, recovery=%s, finish=%s.",
$devices{$k}, $status{$k}, $recovery{$k}, $finish{$k};
$code = max_state($code, "OK");
} else {
if ($active{$k}) {
- $msg .= sprintf " %s active with no status information.\n",
+ $msg .= sprintf " %s active with no status information.",
$devices{$k};
$code = max_state($code, "OK");
} else {
+ # This should't run anymore, but is left as a catch-all
$msg .= sprintf " %s does not exist.\n", $devices{$k};
$code = max_state($code, "CRITICAL");
}