Author: glen                         Date: Thu May 24 08:17:34 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
remaining patch from Steffen Zieger (see r1.99)

---- Files affected:
packages/nagios-plugin-check_raid:
   check_raid (1.119 -> 1.120) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.119 
packages/nagios-plugin-check_raid/check_raid:1.120
--- packages/nagios-plugin-check_raid/check_raid:1.119  Wed Apr 11 19:42:59 2012
+++ packages/nagios-plugin-check_raid/check_raid        Thu May 24 10:17:29 2012
@@ -324,7 +324,7 @@
        unshift(@CMD, $sudo) if $> and $sudo;
 
        open(my $fh , '-|', @CMD) or return;
-       my (@status, @devs, @vols, %cur);
+       my (@status, @devs, @vols, %cur, %cur_vol);
        while (<$fh>) {
                if (my($s) = /Device Id: (\S+)/) {
                        push(@devs, { %cur }) if %cur;
@@ -349,8 +349,31 @@
        close $fh;
        push(@devs, { %cur }) if %cur;
 
+       my @CMD_vol = ($megacli, '-LdInfo', '-Lall', '-aALL', '-NoLog');
+       unshift(@CMD_vol, $sudo) if $> and $sudo;
+
+       open(my $fh_vol, '-|', @CMD_vol) or return;
+       while (<$fh_vol>) {
+               if (my($s) = /Name\s*:\s*(\S+)/) {
+                       push(@vols, { %cur_vol }) if %cur_vol;
+                       %cur_vol = ( name => $s, state => undef );
+                       next;
+               }
+               if (my($s) = /State\s*:\s*(\S+)/) {
+                       $cur_vol{state} = $s;
+                       next;
+               }
+       }
+       close $fh_vol;
+       push(@vols, { %cur_vol }) if %cur_vol;
+
        my @vstatus;
        foreach my $vol (@vols) {
+               # It's possible to create volumes without a name
+               if (!$vol->{name}) {
+                       $vol->{name} = 'NoName';
+               }
+
                push(@vstatus, sprintf "%s:%s", $vol->{name}, $vol->{state});
                if ($vol->{state} ne 'Optimal') {
                        $status = $ERRORS{CRITICAL};
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/packages/nagios-plugin-check_raid/check_raid?r1=1.119&r2=1.120

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

Reply via email to