Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check HP MSA P2000
v1
2012-10-01
- Nagios 3.x
- Nagios XI
GPL
77816
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
V1.1 fixes a bug whereby a broken disk may not show up in later Firmwares. In v1.1 multiple API calls are used to determine the health of the SAN. Upgrade to v1.1 as soon as possible.
This checks the HP P2000 for the status of all parts within the SAN, this includes all Enclosures, Fans, Voltages, Disks and Temperatures. SNMP is not needed for this as it uses the inbuilt API to gather the status and performance counters.
The check can also get performance data about about IOPS, Bytes a Second and more by using the API to run statistic commands if the firmware supports it. The commands runs through the API are disk-statistics, controller-statistics, vdisk-statistics and volume-statistics.
The option L is required and is the login string which is a hashed combination of your username and password. The best way to get this auth string is to capture packets when logging in to the storage manager HTTP interface and look for the first HTTP post. You can use fiddler or wireshark to do this.
For performance data set -c option to what performance data you want I.e. disk, controller, volume or vdisk then specify -S for what type of performance data you want I.e. cpu-load, iops, bytes-per-second etc.
Usage:
This script sends HTTP Requests to the specified HP P2000 Array to determine its health
and outputs performance data fo other checks.
Required Variables:
-H Hostname or IP Address
-L Login Information
Optional Variables:
These options are not required. Both critical and warning must be specified together
If warning/critical is specified -t must be specified or it defaults to greaterthan.
-s Set to 1 for Secure HTTPS Connection
-c Sets what you want to do
status - get the status of the SAN
disk - Get performance data of the disks
controller - Get performance data of the controllers
vdisk - Get performance data of the VDisks
volume - Get performance data of the volumes
-S specify the stats to get for performance data. ONLY works when -c is specified
-u Units of measure. What should be appended to performance values. ONLY used when -c specified.
-w Specify Warning value
-C Specify Critical value
-t Specify how critical warning is calculated (DEFAULT greaterthan)
lessthan - if value is lessthan warning/critical return warning/critical
greaterthan - if value is greaterthan warning/critical return warning/critical
Examples
Just get the status of the P2000
./check_p2000_api.php -H 192.168.0.2 -L 948b44579e48f69ce431909719534307
Get the CPU load of the controllers and append % to the output
./check_p2000_api.php -H 192.168.0.2 -L 948b44579e48f69ce431909719534307 -s 1 -c controller -S cpu-load -u "%"
Get the CPU load of the controllers and append % to the output warning if its over 30 or critical if its over 60
./check_p2000_api.php -H 192.168.0.2 -L 948b44579e48f69ce431909719534307 -s 1 -c controller -S cpu-load -u "%" -w 30 -C 60
Setting option -c to anything other than status will output performance data for Nagios to process.
You can find certain stat options to use by logging into SAN Manager through the web interface and
manually running the commands in the API. Some options are iops, bytes-per-second-numeric, cpu-load,
write-cache-percent and others. If using Warning/Critical options specify a stat without any Units
otherwise false states will be returned. You can specify units yourself using -u option.
This checks the HP P2000 for the status of all parts within the SAN, this includes all Enclosures, Fans, Voltages, Disks and Temperatures. SNMP is not needed for this as it uses the inbuilt API to gather the status and performance counters.
The check can also get performance data about about IOPS, Bytes a Second and more by using the API to run statistic commands if the firmware supports it. The commands runs through the API are disk-statistics, controller-statistics, vdisk-statistics and volume-statistics.
The option L is required and is the login string which is a hashed combination of your username and password. The best way to get this auth string is to capture packets when logging in to the storage manager HTTP interface and look for the first HTTP post. You can use fiddler or wireshark to do this.
For performance data set -c option to what performance data you want I.e. disk, controller, volume or vdisk then specify -S for what type of performance data you want I.e. cpu-load, iops, bytes-per-second etc.
Usage:
This script sends HTTP Requests to the specified HP P2000 Array to determine its health
and outputs performance data fo other checks.
Required Variables:
-H Hostname or IP Address
-L Login Information
Optional Variables:
These options are not required. Both critical and warning must be specified together
If warning/critical is specified -t must be specified or it defaults to greaterthan.
-s Set to 1 for Secure HTTPS Connection
-c Sets what you want to do
status - get the status of the SAN
disk - Get performance data of the disks
controller - Get performance data of the controllers
vdisk - Get performance data of the VDisks
volume - Get performance data of the volumes
-S specify the stats to get for performance data. ONLY works when -c is specified
-u Units of measure. What should be appended to performance values. ONLY used when -c specified.
-w Specify Warning value
-C Specify Critical value
-t Specify how critical warning is calculated (DEFAULT greaterthan)
lessthan - if value is lessthan warning/critical return warning/critical
greaterthan - if value is greaterthan warning/critical return warning/critical
Examples
Just get the status of the P2000
./check_p2000_api.php -H 192.168.0.2 -L 948b44579e48f69ce431909719534307
Get the CPU load of the controllers and append % to the output
./check_p2000_api.php -H 192.168.0.2 -L 948b44579e48f69ce431909719534307 -s 1 -c controller -S cpu-load -u "%"
Get the CPU load of the controllers and append % to the output warning if its over 30 or critical if its over 60
./check_p2000_api.php -H 192.168.0.2 -L 948b44579e48f69ce431909719534307 -s 1 -c controller -S cpu-load -u "%" -w 30 -C 60
Setting option -c to anything other than status will output performance data for Nagios to process.
You can find certain stat options to use by logging into SAN Manager through the web interface and
manually running the commands in the API. Some options are iops, bytes-per-second-numeric, cpu-load,
write-cache-percent and others. If using Warning/Critical options specify a stat without any Units
otherwise false states will be returned. You can specify units yourself using -u option.
Reviews (4)
English:
Version 1.6, on an MSA2324sa, to have it working I've commented "Get Sensor Information" section (lines 181 to 201) and also lines looking for parameter "health-recommendation" (lines 326 and 376).
Spanish:
En la versión 1.6, para un MSA2324sa, para que funcione, comenté la sección "Get Sensor Information" (lineas 181 a la 201) y también las líneas que buscan el parámetro "health-recommendation" (líneas 326 y 376).
Version 1.6, on an MSA2324sa, to have it working I've commented "Get Sensor Information" section (lines 181 to 201) and also lines looking for parameter "health-recommendation" (lines 326 and 376).
Spanish:
En la versión 1.6, para un MSA2324sa, para que funcione, comenté la sección "Get Sensor Information" (lineas 181 a la 201) y también las líneas que buscan el parámetro "health-recommendation" (líneas 326 y 376).
bysziloo, December 9, 2015
First of all, great script thx.
We use it to monitor a P2000 with two enclosures, and it's working like a charm. Recently we bought an MSA 1040. Is it possible to monitor it with this plugin? We tried but I've got error:
Invalid argument supplied for foreach() in on line 137
We use it to monitor a P2000 with two enclosures, and it's working like a charm. Recently we bought an MSA 1040. Is it possible to monitor it with this plugin? We tried but I've got error:
Invalid argument supplied for foreach() in on line 137
byPeer, March 5, 2015
1 of 1 people found this review helpful
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
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