summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnagios-check-hpacucli31
1 files changed, 24 insertions, 7 deletions
diff --git a/nagios-check-hpacucli b/nagios-check-hpacucli
index 2104f51..26a07fe 100755
--- a/nagios-check-hpacucli
+++ b/nagios-check-hpacucli
@@ -90,9 +90,9 @@ for my $slot (sort @controllers) {
chomp;
next if /^$/;
next if /^ *array [A-Z]$/;
+ next if (/^\S.*in Slot $slot/);
if (/^Error: The specified controller does not have any physical drives on it.$/) {
$nodrives = 1;
- } elsif (/^\S.*in Slot $slot/) {
} elsif (/^ *physicaldrive (\S+) .* (OK|Predictive Failure|Failed)(?:, spare)?\)$/) {
my $drive = $1;
my $status = $2;
@@ -113,15 +113,32 @@ for my $slot (sort @controllers) {
if ($nodrives && scalar keys %status > 0) {
push @resultstr, "Slot $slot: have no drives but status results?";
record('UNKNOWN');
+ next;
} elsif ($nodrives) {
push @resultstr, "Slot $slot: no drives";
- } elsif (scalar keys %status > 0) {
- push @resultstr, "Slot $slot: ".join("; ", (map { $_.": ".join(", ", @{$status{$_}}) } keys %status));
- } else {
- push @resultstr, "Slot $slot: no results?";
- record('UNKNOWN');
+ next;
+ };
+
+ my $cst = runcmd("controller slot=$slot show status");
+ for (@$cst) {
+ chomp;
+ next if /^$/;
+ next if (/^\S.*in Slot $slot/);
+ if (/^ *(.*) Status: (.*)$/) {
+ my $system = $1;
+ my $status = $2;
+ push @{$status{$status}}, $system;
+ if ($status ne 'OK') {
+ record('WARNING');
+ };
+ } else {
+ die ("Cannot read line '$_' gotten from hpacucli controller slot=$slot show status\n");
+ };
};
+
+ my $status = join("; ", (map { $_.": ".join(", ", @{$status{$_}}) } keys %status));
+ push @resultstr, "Slot $slot: $status";
};
-print "$EXITCODE: ", join(";; ", @resultstr), "\n";
+print "$EXITCODE: ", join(" - ", @resultstr), "\n";
exit $CODE{$EXITCODE};