summaryrefslogtreecommitdiffstats
path: root/contrib/check_linux_raid.pl
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2010-10-06 03:19:03 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2010-10-06 03:19:03 (GMT)
commite30f77864054e54f3c777aee0315f9c13b10957d (patch)
tree8f87eb27734546534135816e270c67116557c293 /contrib/check_linux_raid.pl
parentbfe20df4a54f9b173e87cf2b13db0998a6303335 (diff)
downloadmonitoring-plugins-e30f77864054e54f3c777aee0315f9c13b10957d.tar.gz
Patch for check_linux_raid with on linear/raid0 arrays
Fixes bug #3049988, Debian bug #579049
Diffstat (limited to 'contrib/check_linux_raid.pl')
-rw-r--r--contrib/check_linux_raid.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/check_linux_raid.pl b/contrib/check_linux_raid.pl
index d2e5b46..77e75f6 100644
--- a/contrib/check_linux_raid.pl
+++ b/contrib/check_linux_raid.pl
@@ -71,7 +71,8 @@ while(defined $nextdev){
71 } elsif (/^($nextdev)\s*:/) { 71 } elsif (/^($nextdev)\s*:/) {
72 $device=$1; 72 $device=$1;
73 $devices{$device}=$device; 73 $devices{$device}=$device;
74 if (/active/) { 74 if (/\sactive/) {
75 $status{$device} = ''; # Shall be filled later if available
75 $active{$device} = 1; 76 $active{$device} = 1;
76 } 77 }
77 } 78 }
@@ -80,7 +81,11 @@ while(defined $nextdev){
80} 81}
81 82
82foreach my $k (sort keys %devices){ 83foreach my $k (sort keys %devices){
83 if ($status{$k} =~ /_/) { 84 if (!exists($status{$k})) {
85 $msg .= sprintf " %s inactive with no status information.",
86 $devices{$k};
87 $code = max_state($code, "CRITICAL");
88 } elsif ($status{$k} =~ /_/) {
84 if (defined $recovery{$k}) { 89 if (defined $recovery{$k}) {
85 $msg .= sprintf " %s status=%s, recovery=%s, finish=%s.", 90 $msg .= sprintf " %s status=%s, recovery=%s, finish=%s.",
86 $devices{$k}, $status{$k}, $recovery{$k}, $finish{$k}; 91 $devices{$k}, $status{$k}, $recovery{$k}, $finish{$k};
@@ -94,10 +99,11 @@ foreach my $k (sort keys %devices){
94 $code = max_state($code, "OK"); 99 $code = max_state($code, "OK");
95 } else { 100 } else {
96 if ($active{$k}) { 101 if ($active{$k}) {
97 $msg .= sprintf " %s active with no status information.\n", 102 $msg .= sprintf " %s active with no status information.",
98 $devices{$k}; 103 $devices{$k};
99 $code = max_state($code, "OK"); 104 $code = max_state($code, "OK");
100 } else { 105 } else {
106 # This should't run anymore, but is left as a catch-all
101 $msg .= sprintf " %s does not exist.\n", $devices{$k}; 107 $msg .= sprintf " %s does not exist.\n", $devices{$k};
102 $code = max_state($code, "CRITICAL"); 108 $code = max_state($code, "CRITICAL");
103 } 109 }