Faidon Liambotis has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354080 )

Change subject: raid/hpssacli: check for cable errors/no batteries
......................................................................


raid/hpssacli: check for cable errors/no batteries

T163777 had a case where the following "show status" resulted in an OK:
   Controller Status: OK
   Cache Status: Permanently Disabled

We already fixed the check to emit a WARNING when Cache Status is not
"OK" or "Not Configured" in a previous commit, but it seems there's
another thing we could check: "controller slot=N show detail". This had
a few more values we could check, and specifically:
   Cache Status Details: Cable Error
   Battery/Capacitor Count: 0

Emit CRITICAL for the former, and CRITICAL for the latter if the count
is 0 and the argument --no-battery hasn't been passed to us.

This is untested on systems that have no battery by design -- hopefully,
Cable Error won't be reported on these.

Bug: T163998
Change-Id: Iaa099ec825a86445f6e79cfad895e9aec757725c
---
M modules/raid/files/dsa-check-hpssacli
1 file changed, 13 insertions(+), 6 deletions(-)

Approvals:
  Faidon Liambotis: Looks good to me, approved
  jenkins-bot: Verified
  Filippo Giunchedi: Looks good to me, but someone else must approve



diff --git a/modules/raid/files/dsa-check-hpssacli 
b/modules/raid/files/dsa-check-hpssacli
index d10874b..8ae7121 100755
--- a/modules/raid/files/dsa-check-hpssacli
+++ b/modules/raid/files/dsa-check-hpssacli
@@ -111,6 +111,7 @@
        my @drives;
        my $nodrives = 0;
        my %status;
+       my @freetext;
 
        my $ldallshow = runcmd("controller slot=$slot ld all show");
        my @logicaldrives;
@@ -300,12 +301,12 @@
                next;
        };
 
-       my $cst = runcmd("controller slot=$slot show status");
+       my $cst = runcmd("controller slot=$slot show detail");
        for (@$cst) {
                chomp;
                next if /^$/;
                next if (/^\S.*in Slot $slot/);
-               if (/^ *(.*) Status: (.*)$/) {
+               if (/^ *(Controller|Cache|Battery\/Capacitor) Status: (.*)$/) {
                        my $system = $1;
                        my $status = $2;
 
@@ -318,17 +319,23 @@
                                next if $status =~ /^(OK|Not Configured)$/;
                        }
 
-                       push @{$status{$status}}, $system;
+                       push @freetext, "$system: $status";
                        if ($status ne 'OK') {
                                next if ($params->{'no-battery'} && $system eq 
'Battery/Capacitor');
                                record('WARNING');
                        };
-               } else {
-                       die ("Cannot read line '$_' gotten from hpssacli 
controller slot=$slot show status\n");
+               } elsif (/^ *(Cache Status Details): (Cable Error)/) {
+                       push @freetext, $2;
+                       record('CRITICAL');
+               } elsif (/^ *(Battery\/Capacitor Count): (.*)/) {
+                       next if $params->{'no-battery'} || int($2) > 0;
+                       push @freetext, "Battery count: $2";
+                       record('CRITICAL');
                };
        };
 
-       my $status = join(" - ", (map { $_.": ".join(", ", @{$status{$_}}) } 
keys %status));
+       my $status = join(" - ", ((map { $_.": ".join(", ", @{$status{$_}}) } 
keys %status), @freetext));
+
        push @resultstr, "Slot $slot: $status";
 };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/354080
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa099ec825a86445f6e79cfad895e9aec757725c
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to