Monitor HP RAID Array on Debian

Note: This article has been updated at Monitor HP RAID Array (R1)
If you read my previous article detailing how to Install HP ACU CLI on Debian, then your next logical question might be, how do I monitor the RAID array. Searching the net will yield a multitude of solutions however, we are fan’s of simple small footprint solutions, so that is the approach we will take. Our automated monitoring system will consist of calling our check-array script (shown below) using crontab. If you were to use smartmontools or nagios, it would essentially be doing the same thing but with a much larger footprint. Looking at the HP RAID documentation here, you will notice there are three solutions. We have chosen to go with cciss-vol-status. This will give us the framework needed to build a simple monitoring script. To install and check cciss-vol-status, run the command below in terminal.

apt-get install cciss-vol-status && cciss_vol_status /dev/cciss/c*d0

Note: the code above will work with most HP Array Controllers, however for a more definitive list please refer to the Debian Server HP RAID documentation on the subject here.
Once you have run the command above you should see an output similar to that pictured below.cciss-vol-status This will show the report of the RAID Controller status.
Assuming you get an output similar to that pictured above, we can move on to the next step and create our script that will run from cron and alert the server admin in the event of an array failure. Below is our check-array script which in this case will be placed in the /root directory.
Note: the script must be executable with permissions of at least 0700

#!/bin/bash
#
# Check status of RAID volumes on HP Smart Array controllers.
#
#
status=`cciss_vol_status /dev/cciss/c*d0`

if echo $status | grep -q Failed
then
	echo -e "${status}" | mail -s "RAID Alert: Server ($(hostname)) Drive Failure!" -a "From: SRV Automation <from@email.com>" to@email.com
fi

Once our script is created, we will need to open up our crontab and call the script every hour. This can be accomplished by running crontab -e as the user that will run the script. Once the crontab edit screen is open, you will want to place the code below in the file and then save the crontab.

0 * * * * /root/check-array &> /dev/null

Once the crontab is saved, it will run the check-array script every hour. A simple way to test the script is to simply change the word “Failed” in the script to “OK”. There you have it, a small footprint RAID monitoring solution for HP Array Controllers

Did you find this article useful? Why not share it with your friends?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.