We have just finished installing our new HP P2000 SAN ready for the implementation of our VMWare set up next week and thought we should set up some monitoring other than basic pings for them in Nagios! HP supplied the SNMP MIBs with the SAN, but rather than write new SNMP queries for everything we wanted to monitor, I thought I would search the Nagios Exchange first to see if anyone else had already created such a plugin.
Thomas was suggesting using Wireshark to sniff out an Authentication string to pass to your P2000 to enable Nagios to log in. Now whilst I am not adverse to using Wireshark when necessary I thought there must be a nicer way of handling the authentication for this plug-in. Another user Johan seemed to think the same and had commented with details of how the auth string could be programmatically created and provided a Perl example on his own blog.
I then set about tweaking Thomas’ script to use the method provided by Johan to pass the username and password through Nagios to the P2000. It is really only a minor tweak and the adjusted version of the script is available here on PasteBin.
I then added the username and password for my P2000 (I used the built-in monitor user account and the password for that which had been changed and saved to KeePass when setting up the P2000) in the nagios resources.cfg file as $USERx$ variables. This then meant I could define a command in nagios as follows:
# ‘check_p2000’ command definition
command_line $USER1$/check_p2000_api.php -H $HOSTADDRESS$ -U $USER6$ -P $USER7$ -s 1
N.B. The “-s 1” at the end of the command definition was needed as we disabled plain HTTP access to our P2000 and only allowed HTTPS access.
And then a service definition too:
service_description P2000 Status and Performance Monitor
We are now checking a whole wealth of data on our P2000 SAN thanks to this script!
! EDIT! – Please check out part 2 to this post here.