Random Project

Bug when more then 1 enclosure is attached

First, great plugin and very useful.
Nice to see how simple is HP MSA API.

Wanted to share that with 1 MSA enclosure the plugin works great.
We encounter problems when we monitored MSA that has MSA2600 extension enclosure.
I found the bug that caused the plugin to exit with CRITICAL exit status, where more then 1 enclosure is attached to the MSA. See reports here at the bottom:
http://www.toms-blog.com/nagios-hp-msa-p2000-status-and-performance-monitor/

The problem is that on show/frus API, there are several XML elements added with no fru-shortname value and so fru-status is “Absent”, which reports back to Nagios as critical, although the enclosure status is OK.
I fixed it by ignoring those empty XML elements:

+++ libexec/check_msa_p2000.php (…/libexec/check_msa_p2000.php) (working copy)
@@ -210,6 +210,9 @@
$attr = $obj->attributes();
if($attr[‘name’]== “fru”) {
$type = (string) getEnclosureStatus($obj->PROPERTY, array(‘name’=>’name’, ‘value’=>’fru-shortname’));
+ if (empty($type)) {
+ continue;
+ }
$statuses[$type][]= getEnclosureStatus($obj->PROPERTY, array(‘name’=>’name’, ‘value’=>’fru-status’));
}
}

David