dsa-check-hpssacli: check PDs only when in HBA mode
authorFilippo Giunchedi <filippo@debian.org>
Tue, 6 Feb 2018 21:27:49 +0000 (22:27 +0100)
committerJulien Cristau <jcristau@debian.org>
Tue, 6 Feb 2018 21:29:55 +0000 (22:29 +0100)
when using dsa-check-hpssacli with controllers in HBA mode the check
misbehaves on the "HBA Drives" line itself. The patch below fixes things
to check only PDs in the HBA case.

We've discovered this at Wikimedia Foundation where the check is also
deployed, see https://phabricator.wikimedia.org/T185216 for more
context.

dsa-nagios-checks/checks/dsa-check-hpssacli

index 8ae7121..3dfd488 100755 (executable)
@@ -180,6 +180,12 @@ for my $slot (sort @controllers) {
                next if (/^\S.*in Slot $slot/);
                next if /^ *array [A-Z]$/;
                next if /^ *unassigned/;
+               if (/^ *HBA Drives/) {
+                       # HBA mode implies no logical drives, thus reset the "drives found" check and proceed with
+                       # checking physical drives.
+                       $nodrives = 0;
+                       next;
+               }
                if (/^ *(array [A-Z]) \(Failed\)$/) {
                        record('CRITICAL');
                        push @{$status{'Failed'}}, $1;