X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=dsa-nagios-checks%2Fchecks%2Fdsa-check-hpssacli;h=29826009dd99038b7f612d50f197d3f002153cda;hb=3722e31f9385e9a1edad92073167c7122dbcfcb9;hp=8ae712101b79afac7034cdd70d80a9083d82fa25;hpb=d12a96228342f968b0bbd470d5cbdb71cc94081c;p=mirror%2Fdsa-nagios.git diff --git a/dsa-nagios-checks/checks/dsa-check-hpssacli b/dsa-nagios-checks/checks/dsa-check-hpssacli index 8ae7121..2982600 100755 --- a/dsa-nagios-checks/checks/dsa-check-hpssacli +++ b/dsa-nagios-checks/checks/dsa-check-hpssacli @@ -64,13 +64,14 @@ sub record($) { }; } -my $usage = "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--no-battery] [--ignore-controller=] [--no-controller-ok] [--ignore-transfer-speed= [--ignore-transfer-speed= ...]]\n"; +my $usage = "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--no-battery] [--ignore-cache] [--ignore-controller=] [--no-controller-ok] [--ignore-transfer-speed= [--ignore-transfer-speed= ...]]\n"; my $params; Getopt::Long::Configure('bundling'); if (!GetOptions ( '--help' => \$params->{'help'}, '--no-battery' => \$params->{'no-battery'}, '--no-controller-ok' => \$params->{'no-controller-ok'}, + '--ignore-cache' => \$params->{'ignore-cache'}, '--ignore-controller=s' => \$params->{'ignore-controller'}, '--ignore-transfer-speed=s@' => \$params->{'ignore-transfer-speed'}, )) { @@ -180,12 +181,18 @@ 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; } elsif (/^Error: The specified controller does not have any physical drives on it.$/) { $nodrives = 1; - } elsif (/^ *physicaldrive (\S+) .* (OK|Predictive Failure|Failed|Rebuilding)(?:, (?:active )?spare)?\)$/) { + } elsif (/^ *physicaldrive (\S+) .* (OK|Predictive Failure|Failed|Rebuilding)(?:, (?:active )?spare.*)?\)$/) { my $drive = $1; my $status = $2; push @{$status{$status}}, $drive; @@ -317,6 +324,10 @@ for my $slot (sort @controllers) { # - 'Permanently Disabled' # - ...? next if $status =~ /^(OK|Not Configured)$/; + if ($params->{'ignore-cache'}) { + push @freetext, "$system: $status (ignored)"; + next; + } } push @freetext, "$system: $status";