diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/check_linux_raid.pl | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/contrib/check_linux_raid.pl b/contrib/check_linux_raid.pl index 73e7fd2..6650a42 100644 --- a/contrib/check_linux_raid.pl +++ b/contrib/check_linux_raid.pl | |||
@@ -28,8 +28,8 @@ use utils qw(%ERRORS); | |||
28 | 28 | ||
29 | # die with an error if we're not on Linux | 29 | # die with an error if we're not on Linux |
30 | if ($^O ne 'linux') { | 30 | if ($^O ne 'linux') { |
31 | print "This plugin only applicable on Linux.\n"; | 31 | print "This plugin only applicable on Linux.\n"; |
32 | exit $ERRORS{'UNKNOWN'}; | 32 | exit $ERRORS{'UNKNOWN'}; |
33 | } | 33 | } |
34 | 34 | ||
35 | sub max_state($$){ | 35 | sub max_state($$){ |
@@ -66,10 +66,10 @@ while(defined $nextdev){ | |||
66 | $recovery{$device} = $1; | 66 | $recovery{$device} = $1; |
67 | ($finish{$device}) = /finish=(.*?min)/; | 67 | ($finish{$device}) = /finish=(.*?min)/; |
68 | $device=undef; | 68 | $device=undef; |
69 | } elsif (/resync =\s+(.*?)\s/) { | 69 | } elsif (/resync =\s+(.*?)\s/) { |
70 | $resyncing{$device} = $1; | 70 | $resyncing{$device} = $1; |
71 | ($finish{$device}) = /finish=(.*?min)/; | 71 | ($finish{$device}) = /finish=(.*?min)/; |
72 | $device=undef; | 72 | $device=undef; |
73 | } elsif (/^\s*$/) { | 73 | } elsif (/^\s*$/) { |
74 | $device=undef; | 74 | $device=undef; |
75 | } | 75 | } |
@@ -100,14 +100,14 @@ foreach my $k (sort keys %devices){ | |||
100 | $code = max_state($code, "CRITICAL"); | 100 | $code = max_state($code, "CRITICAL"); |
101 | } | 101 | } |
102 | } elsif ($status{$k} =~ /U+/) { | 102 | } elsif ($status{$k} =~ /U+/) { |
103 | if (defined $resyncing{$k}) { | 103 | if (defined $resyncing{$k}) { |
104 | $msg .= sprintf " %s status=%s, resync=%s, finish=%s.", | 104 | $msg .= sprintf " %s status=%s, resync=%s, finish=%s.", |
105 | $devices{$k}, $status{$k}, $resyncing{$k}, $finish{$k}; | 105 | $devices{$k}, $status{$k}, $resyncing{$k}, $finish{$k}; |
106 | $code = max_state($code, "WARNING"); | 106 | $code = max_state($code, "WARNING"); |
107 | } else { | 107 | } else { |
108 | $msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k}; | 108 | $msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k}; |
109 | $code = max_state($code, "OK"); | 109 | $code = max_state($code, "OK"); |
110 | } | 110 | } |
111 | } else { | 111 | } else { |
112 | if ($active{$k}) { | 112 | if ($active{$k}) { |
113 | $msg .= sprintf " %s active with no status information.", | 113 | $msg .= sprintf " %s active with no status information.", |
@@ -123,4 +123,3 @@ foreach my $k (sort keys %devices){ | |||
123 | 123 | ||
124 | print $code, $msg, "\n"; | 124 | print $code, $msg, "\n"; |
125 | exit ($ERRORS{$code}); | 125 | exit ($ERRORS{$code}); |
126 | |||