packages: nagios-plugin-check_raid/check_raid - improved megaraid reporting
glen
glen at pld-linux.org
Thu Oct 8 16:12:00 CEST 2009
Author: glen Date: Thu Oct 8 14:12:00 2009 GMT
Module: packages Tag: HEAD
---- Log message:
- improved megaraid reporting
---- Files affected:
packages/nagios-plugin-check_raid:
check_raid (1.54 -> 1.55)
---- Diffs:
================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.54 packages/nagios-plugin-check_raid/check_raid:1.55
--- packages/nagios-plugin-check_raid/check_raid:1.54 Thu Oct 8 16:04:46 2009
+++ packages/nagios-plugin-check_raid/check_raid Thu Oct 8 16:11:55 2009
@@ -352,8 +352,12 @@
# MegaRAID
sub check_megaraid {
- my $fh;
+
+ # status messages pushed here
+ my @status;
+
foreach my $f (</proc/megaraid/*/raiddrives*>) {
+ my $fh;
if (-r $f) {
open $fh, '<', $f or next;
} else {
@@ -361,20 +365,20 @@
unshift(@CMD, $sudo) if $> and $sudo;
open($fh , '-|', @CMD) or next;
}
+ my ($n) = $f =~ m{/proc/megaraid/([^/]+)};
while (<$fh>) {
- if (my($n, $s) = /logical drive\s*:\s*(\d+).*, state\s*:\s*(\S+)/i) {
- next unless valid($n);
+ if (my($s) = /logical drive\s*:\s*\d+.*, state\s*:\s*(\S+)/i) {
if ($s ne 'optimal') {
$status = $ERRORS{CRITICAL};
- $message .= "Megaraid:$n:$s ";
- } else {
- $message .= "Megaraid:$n:$s ";
}
+ push(@status, "$n: $s");
last;
}
}
close $fh;
}
+
+ $message .= "MegaRAID: ".join(', ', @status) if @status;
}
# Linux Gdth RAID
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/check_raid?r1=1.54&r2=1.55&f=u
More information about the pld-cvs-commit
mailing list