packages: nagios-plugin-check_raid/check_raid - message cosmetics for 3ware...
glen
glen at pld-linux.org
Thu Oct 8 15:57:24 CEST 2009
Author: glen Date: Thu Oct 8 13:57:24 2009 GMT
Module: packages Tag: HEAD
---- Log message:
- message cosmetics for 3ware (tw_cli)
---- Files affected:
packages/nagios-plugin-check_raid:
check_raid (1.52 -> 1.53)
---- Diffs:
================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.52 packages/nagios-plugin-check_raid/check_raid:1.53
--- packages/nagios-plugin-check_raid/check_raid:1.52 Wed Oct 7 11:33:55 2009
+++ packages/nagios-plugin-check_raid/check_raid Thu Oct 8 15:57:18 2009
@@ -436,6 +436,9 @@
my @CMD = $tw_cli;
unshift(@CMD, $sudo) if $> and $sudo;
+ # status messages pushed here
+ my @status;
+
my (@c, $fh);
# scan controllers
open($fh , '-|', @CMD, 'info') or return;
@@ -444,6 +447,12 @@
}
close $fh;
+ unless (@c) {
+ $status = $ERRORS{WARNING} unless $status;
+ $message .= "3ware: No Adapters were found on this machine";
+ return;
+ }
+
for my $c (@c) {
# check each unit on controllers
open($fh , '-|', @CMD, 'info', $c, 'unitstatus') or next;
@@ -451,31 +460,34 @@
next unless (my($u, $s, $p) = /^(u\d+)\s+\S+\s+(\S+)\s+(\S+)/);
if ($s eq 'OK') {
- $message .= "3ware:/$c/$u $s ";
+ push(@status, "$c/$u $s");
} elsif ($s eq 'REBUILDING') {
$status = $ERRORS{WARNING} unless $status;
- $message .= "3ware:/$c/$u $s $p% ";
+ push(@status, "$c/$u $s $p% ");
} elsif ($s eq 'DEGRADED') {
open(my $fh , '-|', @CMD, 'info', $c, 'drivestatus');
- my $ds = '';
+ my @ds;
if ($fh) {
+ my @p;
while (<$fh>) {
next unless (my($p, $s) = /^(p\d+)\s+(\S+)\s+\Q$u\E/);
- $ds .= "$p:$s ";
+ push(@ds, "$p:$s");
}
close $fh;
}
- $message .= "3ware:/$c/$u $s $ds ";
+ push(@status, "$c/$u $s (disks: ".join(' ', @ds). ")");
$status = $ERRORS{CRITICAL};
} else {
- $message .= "3ware:/$c/$u $_ ";
+ push(@status, "$c/$u $_");
$status = $ERRORS{UNKNOWN};
}
}
close $fh;
}
+
+ $message .= "3ware: ".join(', ', @status) if @status;
}
# Adaptec AAC-RAID
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/check_raid?r1=1.52&r2=1.53&f=u
More information about the pld-cvs-commit
mailing list