Author: glen                         Date: Mon Feb  8 12:43:22 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- fix dpt_i2o checking
- improve md and dpt_i2o formatting

---- Files affected:
packages/nagios-plugin-check_raid:
   check_raid (1.66 -> 1.67) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.66 
packages/nagios-plugin-check_raid/check_raid:1.67
--- packages/nagios-plugin-check_raid/check_raid:1.66   Fri Dec 18 16:00:41 2009
+++ packages/nagios-plugin-check_raid/check_raid        Mon Feb  8 13:43:17 2010
@@ -140,6 +140,8 @@
        my($n, $f);
 
        open my $fh, '<', '/proc/mdstat' or return;
+
+       my @status;
        while (<$fh>) {
                if (/^(\S+)\s+:/ ) { $n = $1; $f = ''; next; }
                next if (($f) = /(\S+)\[\d+\]\(F\)/);
@@ -148,12 +150,14 @@
 
                if ($s =~ /_/) {
                        $status = $ERRORS{CRITICAL};
-                       $message .= "md:$n:$f:$s ";
+                       push(@status, "$n:$f:$s");
                } else {
-                       $message .= "md:$n:$s ";
+                       push(@status, "$n:$s");
                }
        }
        close $fh;
+
+       $message .= "md:[".join(', ', @status)."] " if @status;
 }
 
 # Linux, software RAID
@@ -427,18 +431,23 @@
 }
 
 sub check_dpt_i2o {
+       my @status;
        for my $file (</proc/scsi/dpt_i2o/*>) {
                open my $fh, '<', $file or return;
                my ($controller) = $file =~ m{([^/]+$)};
+
                while (<$fh>) {
-                       next if (my ($c, $t, $l, $s) = 
m/TID=\d+,\s+\(Channel=(\d+),\s+Target=(\d+),\s+Lun=(\d+)\)\s+\((\S+)\)/);
-                       if ($s ne "online") {
-                               $status = $ERRORS{CRITICAL} unless $status;
+                       if (my ($c, $t, $l, $s) = 
m/TID=\d+,\s+\(Channel=(\d+),\s+Target=(\d+),\s+Lun=(\d+)\)\s+\((\S+)\)/) {
+                               if ($s ne "online") {
+                                       $status = $ERRORS{CRITICAL} unless 
$status;
+                               }
+                               push(@status, "$c,$t,$l:$s");
                        }
-                       $message .= "dpt_i2o:$c,$t,$l:$s ";
                }
                close($fh);
        }
+
+       $message .= "dpt_i2o:[".join(', ', @status)."] " if @status;
 }
 
 # 3ware SATA RAID
================================================================

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

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to