[nagiosplug] update check_linux_raid to take in consideration ...

"Nagios Plugin Development" <[email protected]> Sat, 17 Aug 2013 22:50:22 +0000
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
    Module: nagiosplug
    Branch: master
    Commit: 130eb9635ce86a4c86d593bf5018cd4640d629c5
    Author: Erwan Ben Souiden <[email protected]>
 Committer: Holger Weiss <[email protected]>
      Date: Tue Jun 11 11:10:49 2013 +0200
       URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=130eb96

update check_linux_raid to take in consideration resync status and rise up a warning alert

---

 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 c24b0cd..73e7fd2 100644
--- a/contrib/check_linux_raid.pl
+++ b/contrib/check_linux_raid.pl
@@ -50,6 +50,7 @@ my $code = "UNKNOWN";
 my $msg = "";
 my %status;
 my %recovery;
+my %resyncing;
 my %finish;
 my %active;
 my %devices;
@@ -65,6 +66,10 @@ while(defined $nextdev){
 				$recovery{$device} = $1;
 				($finish{$device}) = /finish=(.*?min)/;
 				$device=undef;
+            } elsif (/resync =\s+(.*?)\s/) {
+                $resyncing{$device} = $1;
+                ($finish{$device}) = /finish=(.*?min)/;
+                $device=undef;
 			} elsif (/^\s*$/) {
 				$device=undef;
 			}
@@ -95,8 +100,14 @@ foreach my $k (sort keys %devices){
 			$code = max_state($code, "CRITICAL");
 		}
 	} elsif ($status{$k} =~ /U+/) {
-		$msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k};
-		$code = max_state($code, "OK");
+        if (defined $resyncing{$k}) {
+            $msg .= sprintf " %s status=%s, resync=%s, finish=%s.",
+                $devices{$k}, $status{$k}, $resyncing{$k}, $finish{$k};
+            $code = max_state($code, "WARNING");
+        } else {
+            $msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k};
+            $code = max_state($code, "OK");
+        }
 	} else {
 		if ($active{$k}) {
 			$msg .= sprintf " %s active with no status information.",


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk