Previously I wrote and article detailing how to Monitor HP RAID Array on Debian, unfortunately since that writing I have found a fatal flaw in it’s methodology. While our automated monitoring system using cciss-vol-status will in fact report a failed drive/array, it’s flaw lies in not reporting a predictive drive failure. The hpacucli tool is a good source of information and when combined with a bash script, it can be a robust solution for reporting. Assuming you have followed my previous article on how to Install HP ACU CLI on Debian, no other software will be required for this tutorial. Below is our check-array
script which in this case will be placed in the /root
directory. This script can certainly be extended, but at this time currently supports reporting of a failed drive, predictive failed drive and array rebuild task.
#!/bin/bash # # Check status of RAID volumes on HP Smart Array controllers. # # status=`/opt/compaq/hpacucli/bld/hpacucli ctrl slot=0 pd all show status` if echo $status | grep -q Failed; then echo -e "${status}" | mail -s "RAID Alert: ($(hostname)) Drive Failure!" -a "From: SRV Automation <from@email.com>" to@email.com elif echo $status | grep -q Predictive; then echo -e "${status}" | mail -s "RAID Alert: ($(hostname)) Predictive Drive Failure!" -a "From: SRV Automation <from@email.com>" to@email.com elif echo $status | grep -q Rebuilding; then echo -e "${status}" | mail -s "RAID Alert: ($(hostname)) Array Rebuild In Progress!" -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
Thanks for this. Very nice solution.
Thanks Mark!