packages: nagios-plugin-check_raid/check_raid - fix/improve gdth output

glen glen at pld-linux.org
Fri Sep 11 15:46:50 CEST 2009


Author: glen                         Date: Fri Sep 11 13:46:50 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- fix/improve gdth output

---- Files affected:
packages/nagios-plugin-check_raid:
   check_raid (1.41 -> 1.42) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.41 packages/nagios-plugin-check_raid/check_raid:1.42
--- packages/nagios-plugin-check_raid/check_raid:1.41	Fri Sep 11 14:52:42 2009
+++ packages/nagios-plugin-check_raid/check_raid	Fri Sep 11 15:46:45 2009
@@ -370,20 +370,29 @@
 #  Slave Number:  15              Status:         ok
 #  Missing Drv.:  0               Invalid Drv.:   0
 #  To Array Drv.: --
+
+	# status messages pushed here
+	my @status;
 	for my $file (</proc/scsi/gdth/*>) {
 		open my $fh, '<', $file or return;
 		my ($controller) = $file =~ m{([^/]+$)};
+		my @ld;
 		while (<$fh>) {
-			chomp;
 			last if (/Array Drives:/); # Stop after the Logical Drive block
-			next if (my ($num, $s) = m/^\s+Number:\s+(\d+)\s+Status:\s+(\S+)$/);
-			if ($s ne "ok") {
-				$status = $ERRORS{CRITICAL} unless $status;
+
+			# Match items from Logical Drivers
+			if (my($num, $s) = m/^\s+Number:\s+(\d+)\s+Status:\s+(\S+)/) {
+				if ($s ne "ok") {
+					$status = $ERRORS{CRITICAL} unless $status;
+				}
+				push(@ld, "$controller,$num:$s");
 			}
-			$message .= "gdth:$controller,$num:$s ";
 		}
 		close($fh);
+		push(@status, "Logical Drive ".join(', ', @ld)) if @ld;
 	}
+
+	$message = "gdth:".join(', ', @status) if @status;
 }
 
 sub check_dpt_i2o {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/check_raid?r1=1.41&r2=1.42&f=u



More information about the pld-cvs-commit mailing list