diff options
author | Peter Palfrader <peter@palfrader.org> | 2008-05-07 19:53:13 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2008-05-07 19:53:13 +0000 |
commit | 9373218c11fbfef514554b3becb4d379697a7dcf (patch) | |
tree | abb0671f79e7d217ab592ac246d4af5326a94771 /nagios-check-hpacucli | |
parent | eccc862ca7f1155abefbb70921ec31400a4401f1 (diff) |
Also check controller status
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@346 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'nagios-check-hpacucli')
-rwxr-xr-x | nagios-check-hpacucli | 31 |
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}; |