packages: nagios-plugin-check_raid/check_raid - model info for 3ware check

glen glen at pld-linux.org
Fri Oct 9 19:09:49 CEST 2009


Author: glen                         Date: Fri Oct  9 17:09:49 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- model info for 3ware check

---- Files affected:
packages/nagios-plugin-check_raid:
   check_raid (1.55 -> 1.56) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.55 packages/nagios-plugin-check_raid/check_raid:1.56
--- packages/nagios-plugin-check_raid/check_raid:1.55	Thu Oct  8 16:11:55 2009
+++ packages/nagios-plugin-check_raid/check_raid	Fri Oct  9 19:09:44 2009
@@ -448,7 +448,9 @@
 	# scan controllers
 	open($fh , '-|', @CMD, 'info') or return;
 	while (<$fh>) {
-		push(@c, $1) if /^(c\d+)/;
+		if (my($c, $model) = /^(c\d+)\s+(\S+)/) {
+			push(@c, [$c, $model]);
+		}
 	}
 	close $fh;
 
@@ -458,18 +460,20 @@
 		return;
 	}
 
-	for my $c (@c) {
+	for my $i (@c) {
+		my ($c, $model) = @$i;
 		# check each unit on controllers
 		open($fh , '-|', @CMD, 'info', $c, 'unitstatus') or next;
+		my @cstatus;
 		while (<$fh>) {
 			next unless (my($u, $s, $p) = /^(u\d+)\s+\S+\s+(\S+)\s+(\S+)/);
 
 			if ($s eq 'OK') {
-				push(@status, "$c/$u $s");
+				push(@cstatus, "$u:$s");
 
 			} elsif ($s eq 'REBUILDING') {
 				$status = $ERRORS{WARNING} unless $status;
-				push(@status, "$c/$u $s $p% ");
+				push(@cstatus, "$u:$s $p% ");
 
 			} elsif ($s eq 'DEGRADED') {
 				open(my $fh , '-|', @CMD, 'info', $c, 'drivestatus');
@@ -482,13 +486,14 @@
 					}
 					close $fh;
 				}
-				push(@status, "$c/$u $s (disks: ".join(' ', @ds). ")");
+				push(@cstatus, "$u:$s (disks: ".join(' ', @ds). ")");
 				$status = $ERRORS{CRITICAL};
 			} else {
-				push(@status, "$c/$u $_");
+				push(@cstatus, "$u:$_");
 				$status = $ERRORS{UNKNOWN};
 			}
 		}
+		push(@status, "$c($model): ". join(',', @cstatus));
 		close $fh;
 	}
 
================================================================

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



More information about the pld-cvs-commit mailing list