summaryrefslogtreecommitdiffstats
path: root/contrib/check_linux_raid.pl
diff options
context:
space:
mode:
authorM. Sean Finney <seanius@users.sourceforge.net>2006-06-07 14:28:33 (GMT)
committerM. Sean Finney <seanius@users.sourceforge.net>2006-06-07 14:28:33 (GMT)
commit3987202794f5b34c78aad3b4213c715ed76004eb (patch)
treeaff04657cdb6516c13fd389ab041ccd67f131184 /contrib/check_linux_raid.pl
parent79ee3b93fb521f591ba78cc2e03351e9baecf5e5 (diff)
downloadmonitoring-plugins-3987202794f5b34c78aad3b4213c715ed76004eb.tar.gz
some gratuitous whitespace changes, and a fix to the "recovery =" detection
logic in check_linux_raid.pl git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1418 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib/check_linux_raid.pl')
-rw-r--r--contrib/check_linux_raid.pl20
1 files changed, 9 insertions, 11 deletions
diff --git a/contrib/check_linux_raid.pl b/contrib/check_linux_raid.pl
index 85d5dc4..11bc3cd 100644
--- a/contrib/check_linux_raid.pl
+++ b/contrib/check_linux_raid.pl
@@ -20,7 +20,7 @@
20# 20#
21# Usage: check_raid [raid-name] 21# Usage: check_raid [raid-name]
22# Example: check_raid md0 22# Example: check_raid md0
23# WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min 23# WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min
24 24
25use strict; 25use strict;
26use lib utils.pm; 26use lib utils.pm;
@@ -61,19 +61,17 @@ while(defined $nextdev){
61 if (defined $device) { 61 if (defined $device) {
62 if (/(\[[_U]+\])/) { 62 if (/(\[[_U]+\])/) {
63 $status{$device} = $1; 63 $status{$device} = $1;
64 $device = undef;
65 } elsif (/recovery = (.*?)\s/) { 64 } elsif (/recovery = (.*?)\s/) {
66 $recovery{$device} = $1; 65 $recovery{$device} = $1;
67 ($finish{$device}) = /finish=(.*?min)/; 66 ($finish{$device}) = /finish=(.*?min)/;
68 $device = undef; 67 } elsif (/^\s*$/) {
68 $device=undef;
69 } 69 }
70 } else { 70 } elsif (/^($nextdev)\s*:/) {
71 if (/^($nextdev)\s*:/) { 71 $device=$1;
72 $device=$1; 72 $devices{$device}=$device;
73 $devices{$device}=$device; 73 if (/active/) {
74 if (/active/) { 74 $active{$device} = 1;
75 $active{$device} = 1;
76 }
77 } 75 }
78 } 76 }
79 } 77 }
@@ -82,7 +80,7 @@ while(defined $nextdev){
82 80
83foreach my $k (sort keys %devices){ 81foreach my $k (sort keys %devices){
84 if ($status{$k} =~ /_/) { 82 if ($status{$k} =~ /_/) {
85 if ($recovery{$k}) { 83 if (defined $recovery{$k}) {
86 $msg .= sprintf " %s status=%s, recovery=%s, finish=%s.", 84 $msg .= sprintf " %s status=%s, recovery=%s, finish=%s.",
87 $devices{$k}, $status{$k}, $recovery{$k}, $finish{$k}; 85 $devices{$k}, $status{$k}, $recovery{$k}, $finish{$k};
88 $code = max_state($code, "WARNING"); 86 $code = max_state($code, "WARNING");