diff options
author | Erwan Ben Souiden <erwan@aleikoum.net> | 2013-06-11 11:10:49 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-18 00:44:25 +0200 |
commit | 130eb9635ce86a4c86d593bf5018cd4640d629c5 (patch) | |
tree | 8db1fba77d733f93becd3d4088da4fce914938bc | |
parent | b5cb208fdc861970c8d7bb5f4317f528ba0d25d3 (diff) | |
download | monitoring-plugins-130eb9635ce86a4c86d593bf5018cd4640d629c5.tar.gz |
update check_linux_raid to take in consideration resync status and rise up a warning alert
-rw-r--r-- | contrib/check_linux_raid.pl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/contrib/check_linux_raid.pl b/contrib/check_linux_raid.pl index c24b0cd2..73e7fd26 100644 --- a/contrib/check_linux_raid.pl +++ b/contrib/check_linux_raid.pl | |||
@@ -50,6 +50,7 @@ my $code = "UNKNOWN"; | |||
50 | my $msg = ""; | 50 | my $msg = ""; |
51 | my %status; | 51 | my %status; |
52 | my %recovery; | 52 | my %recovery; |
53 | my %resyncing; | ||
53 | my %finish; | 54 | my %finish; |
54 | my %active; | 55 | my %active; |
55 | my %devices; | 56 | my %devices; |
@@ -65,6 +66,10 @@ while(defined $nextdev){ | |||
65 | $recovery{$device} = $1; | 66 | $recovery{$device} = $1; |
66 | ($finish{$device}) = /finish=(.*?min)/; | 67 | ($finish{$device}) = /finish=(.*?min)/; |
67 | $device=undef; | 68 | $device=undef; |
69 | } elsif (/resync =\s+(.*?)\s/) { | ||
70 | $resyncing{$device} = $1; | ||
71 | ($finish{$device}) = /finish=(.*?min)/; | ||
72 | $device=undef; | ||
68 | } elsif (/^\s*$/) { | 73 | } elsif (/^\s*$/) { |
69 | $device=undef; | 74 | $device=undef; |
70 | } | 75 | } |
@@ -95,8 +100,14 @@ foreach my $k (sort keys %devices){ | |||
95 | $code = max_state($code, "CRITICAL"); | 100 | $code = max_state($code, "CRITICAL"); |
96 | } | 101 | } |
97 | } elsif ($status{$k} =~ /U+/) { | 102 | } elsif ($status{$k} =~ /U+/) { |
98 | $msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k}; | 103 | if (defined $resyncing{$k}) { |
99 | $code = max_state($code, "OK"); | 104 | $msg .= sprintf " %s status=%s, resync=%s, finish=%s.", |
105 | $devices{$k}, $status{$k}, $resyncing{$k}, $finish{$k}; | ||
106 | $code = max_state($code, "WARNING"); | ||
107 | } else { | ||
108 | $msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k}; | ||
109 | $code = max_state($code, "OK"); | ||
110 | } | ||
100 | } else { | 111 | } else { |
101 | if ($active{$k}) { | 112 | if ($active{$k}) { |
102 | $msg .= sprintf " %s active with no status information.", | 113 | $msg .= sprintf " %s active with no status information.", |