@@ -49,7 +49,7 @@
# Version and similar info
$NAME = 'check_openmanage';
-$VERSION = '3.7.6';
+$VERSION = '3.7.7';
$AUTHOR = 'Trond H. Amundsen';
$CONTACT = 't.h.amundsen@usit.uio.no';
@@ -1697,7 +1697,7 @@
}
# Default
else {
- my $msg = sprintf 'Controller %d [%s] needs attention: %s',
+ my $msg = sprintf 'Controller %d [%s] is %s',
$nexus, $name, $state;
report('storage', $msg, $status2nagios{$status}, $nexus);
}
@@ -1827,8 +1827,10 @@
7 => 'Recovering',
11 => 'Removed',
13 => 'Non-RAID',
+ 14 => 'Not Ready',
15 => 'Resynching',
- 22 => 'Replacing', # FIXME: this one is not defined in the OMSA MIBs
+ 22 => 'Replacing',
+ 23 => 'Spinning Down',
24 => 'Rebuilding',
25 => 'No Media',
26 => 'Formatting',
@@ -1839,6 +1841,7 @@
40 => 'Clear',
41 => 'Unsupported',
53 => 'Incompatible',
+ 56 => 'Read Only',
);
# Check physical disks on each of the controllers
@@ -1875,6 +1878,12 @@
$ctrl = $nexus;
$ctrl =~ s{\A (\d+) : .* \z}{$1}xms;
}
+
+ # workaround for OMSA 7.1.0 bug
+ if ($snmp && $sysinfo{om} eq '7.1.0') {
+ if ($cert == 1) { $cert = 0; }
+ elsif ($cert == 0) { $cert = 1; }
+ }
}
else {
$name = get_nonempty_string('Name', $out, 'Unknown disk');
@@ -1888,7 +1897,7 @@
$media = get_nonempty_string('Media', $out, undef);
$bus = get_nonempty_string('Bus Protocol', $out, undef);
$spare = get_nonempty_string('Hot Spare', $out, q{});
- $cert = get_nonempty_string('Certified', $out, 1);
+ $cert = get_nonempty_string('Certified', $out, 'Yes');
$ctrl = $out->{ctrl};
$capacity = get_nonempty_string('Capacity', $out, q{});
$capacity =~ s{\A .*? \((\d+) \s bytes\) \z}{$1}xms;
@@ -1944,49 +1953,53 @@
elsif (defined $bus && ! defined $media) { $busmedia = "$bus "; }
elsif (! defined $bus && defined $media) { $busmedia = "$media "; }
+ # Variables to collect statuses and states
+ my @states = ($state);
+ my $stack = $status2nagios{$status};
+
# Special case: Failure predicted
- if ($fpred and $status eq 'Ok') {
- my $msg = sprintf '%s [%s %s, %s] on ctrl %d needs attention: Failure Predicted',
- $name, $vendor, $product, $capacity, $ctrl;
- $msg .= " ($state)" if $state ne 'Predictive failure';
- report('storage', $msg, $E_WARNING, $nexus);
- }
- # Special case: Rebuilding / Replacing
- elsif ($state =~ m{\A Rebuilding|Replacing \z}xms) {
- my $msg = sprintf '%s [%s %s, %s] on ctrl %d is %s%s',
- $name, $vendor, $product, $capacity, $ctrl, $state, $progr;
- report('storage', $msg, $E_WARNING, $nexus);
+ if ($fpred) {
+ push @states, 'Failure Predicted';
+ ++$stack if $stack == 0;
}
# Special case: Uncertified disk
- elsif ($status eq 'Non-Critical' and !$cert) {
- if (blacklisted('pdisk_cert', $nexus)) {
- my $msg = sprintf '%s [%s %s, %s] on ctrl %d is %s, Not Certified',
- $name, $vendor, $product, $capacity, $ctrl, $state;
- report('storage', $msg, $E_OK, $nexus);
+ if (!$cert) {
+ # Functional non Dell disks get a Non-Critical status
+ if ($state eq 'Online' and $status eq 'Non-Critical' and blacklisted('pdisk_cert', $nexus)) {
+ --$stack;
}
else {
- my $msg = sprintf '%s [%s %s, %s] on ctrl %d is Not Certified',
- $name, $vendor, $product, $capacity, $ctrl;
- report('storage', $msg, $E_WARNING, $nexus);
+ push @states, 'Not Certified';
}
}
# Special case: Foreign disk
- elsif ($status eq 'Non-Critical' and $state eq 'Foreign'
- and blacklisted('pdisk_foreign', $nexus)) {
- my $msg = sprintf '%s [%s %s, %s] on ctrl %d is %s',
- $name, $vendor, $product, $capacity, $ctrl, $state;
- report('storage', $msg, $E_OK, $nexus);
+ if ($state eq 'Foreign' and blacklisted('pdisk_foreign', $nexus)) {
+ --$stack;
+ }
+
+ # Create combined status and state
+ my $combo_state = join ', ', @states;
+ my $combo_status = undef;
+ if ($stack >= 2) { $combo_status = $E_CRITICAL; }
+ elsif ($stack == 1) { $combo_status = $E_WARNING; }
+ elsif ($stack <= 0) { $combo_status = $E_OK; }
+
+ # Special case: Rebuilding / Replacing
+ if ($state =~ m{\A Rebuilding|Replacing \z}xms) {
+ my $msg = sprintf '%s [%s %s, %s] on ctrl %d is %s%s',
+ $name, $vendor, $product, $capacity, $ctrl, $state, $progr;
+ report('storage', $msg, $E_WARNING, $nexus);
}
# Default
- elsif ($status ne 'Ok') {
- my $msg = sprintf '%s [%s %s, %s] on ctrl %d needs attention: %s',
- $name, $vendor, $product, $capacity, $ctrl, $state;
- report('storage', $msg, $status2nagios{$status}, $nexus);
+ elsif ($combo_status != $E_OK) {
+ my $msg = sprintf '%s [%s %s, %s] on ctrl %d is %s',
+ $name, $vendor, $product, $capacity, $ctrl, $combo_state;
+ report('storage', $msg, $combo_status, $nexus);
}
# Ok
else {
my $msg = sprintf '%s [%s%s] on ctrl %d is %s',
- $name, $busmedia, $capacity, $ctrl, $state;
+ $name, $busmedia, $capacity, $ctrl, $combo_state;
if (defined $spare) { $msg .= " ($spare)"; }
report('storage', $msg, $E_OK, $nexus);
}
@@ -2127,16 +2140,10 @@
report('storage', $msg, $E_WARNING, $nexus);
}
# Default
- elsif ($status ne 'Ok') {
- my $msg = sprintf q{Logical Drive '%s' [%s, %s] needs attention: %s},
- $dev, $layout, $size, $state;
- report('storage', $msg, $status2nagios{$status}, $nexus);
- }
- # Ok
else {
my $msg = sprintf q{Logical Drive '%s' [%s, %s] is %s},
$dev, $layout, $size, $state;
- report('storage', $msg, $E_OK, $nexus);
+ report('storage', $msg, $status2nagios{$status}, $nexus);
}
}
return;
@@ -2297,6 +2304,13 @@
$id, $ctrl, $state, $status;
report('storage', $msg, $E_WARNING, $nexus);
}
+ # Special case: Ready and Non-Critical and "Unknown" predicted status
+ elsif ($state eq 'Ready' && $status eq 'Non-Critical' && $pred eq 'Unknown') {
+ next BATTERY if blacklisted('bat_charge', $nexus);
+ my $msg = sprintf 'Cache Battery %d in controller %d predicted capacity is %s [probably harmless]',
+ $id, $ctrl, $pred;
+ report('storage', $msg, $E_WARNING, $nexus);
+ }
# Default
else {
my $msg = sprintf 'Cache Battery %d in controller %d is %s',
@@ -2626,7 +2640,7 @@
# Default
if ($status ne 'Ok') {
- my $msg = sprintf '%s in enclosure %s [%s] needs attention: %s',
+ my $msg = sprintf '%s in enclosure %s [%s] is %s',
$name, $encl_id, $encl_name, $state;
report('storage', $msg, $status2nagios{$status}, $nexus);
}
@@ -2729,17 +2743,9 @@
next PS if blacklisted('encl_ps', $nexus);
# Default
- if ($status ne 'Ok') {
- my $msg = sprintf '%s in enclosure %s [%s] needs attention: %s',
- $name, $encl_id, $encl_name, $state;
- report('storage', $msg, $status2nagios{$status}, $nexus);
- }
- # Ok
- else {
- my $msg = sprintf '%s in enclosure %s [%s] is %s',
- $name, $encl_id, $encl_name, $state;
- report('storage', $msg, $E_OK, $nexus);
- }
+ my $msg = sprintf '%s in enclosure %s [%s] is %s',
+ $name, $encl_id, $encl_name, $state;
+ report('storage', $msg, $status2nagios{$status}, $nexus);
}
return;
}
@@ -3064,16 +3070,10 @@
report('storage', $msg, $E_OK, $nexus);
}
# Default
- elsif ($status ne 'Ok') {
- my $msg = sprintf '%s in enclosure %s [%s] needs attention: %s',
- $name, $encl_id, $encl_name, $state;
- report('storage', $msg, $status2nagios{$status}, $nexus);
- }
- # Ok
else {
my $msg = sprintf '%s in enclosure %s [%s] is %s',
$name, $encl_id, $encl_name, $state;
- report('storage', $msg, $E_OK, $nexus);
+ report('storage', $msg, $status2nagios{$status}, $nexus);
}
}
return;
@@ -3190,7 +3190,7 @@
$index, $location, $size, $status;
}
else {
- $msg = sprintf 'Memory module %d [%s, %s] needs attention: %s',
+ $msg = sprintf 'Memory module %d [%s, %s]: %s',
$index, $location, $size, (join q{, }, @failures);
}
@@ -3418,16 +3418,9 @@
$count{power}++;
next PS if blacklisted('ps', $index);
- if ($status ne 'Ok') {
- my $msg = sprintf 'Power Supply %d [%s] needs attention: %s',
- $index, $type, $state;
- report('chassis', $msg, $status2nagios{$status}, $index);
- }
- else {
- my $msg = sprintf 'Power Supply %d [%s]: %s',
- $index, $type, $state;
- report('chassis', $msg, $E_OK, $index);
- }
+ my $msg = sprintf 'Power Supply %d [%s]: %s',
+ $index, $type, $state;
+ report('chassis', $msg, $status2nagios{$status}, $index);
}
return;
}
@@ -3929,17 +3922,9 @@
}
# Default
- if ($status ne 'Ok') {
- my $msg = sprintf 'Processor %d [%s] needs attention: %s',
- $index, $brand, $state;
- report('chassis', $msg, $status2nagios{$status}, $index);
- }
- # Ok
- else {
- my $msg = sprintf 'Processor %d [%s] is %s',
- $index, $brand, $state;
- report('chassis', $msg, $E_OK, $index);
- }
+ my $msg = sprintf 'Processor %d [%s] is %s',
+ $index, $brand, $state;
+ report('chassis', $msg, $status2nagios{$status}, $index);
}
return;
}
@@ -4527,7 +4512,7 @@
next SDCARD if blacklisted('sd', $index);
if ($status ne 'Ok') {
- my $msg = sprintf 'SD Card %d needs attention: %s',
+ my $msg = sprintf 'SD Card %d is %s',
$index, $state;
report('chassis', $msg, $E_WARNING, $index);
}
@@ -4915,9 +4900,14 @@
$snmp ? get_snmp_chassis_bios() : get_omreport_chassis_bios();
}
- # Get OMSA information. Only if needed
- if ($opt{okinfo} >= 3 or $opt{debug}) {
- $snmp ? get_snmp_about() : get_omreport_about();
+ # Get OMSA version information
+ if ($snmp) {
+ # always for SNMP because of OMSA 7.1.0 bug
+ get_snmp_about();
+ }
+ elsif ($opt{okinfo} >= 3 or $opt{debug}) {
+ # only if needed
+ get_omreport_about();
}
# Return now if debug
|