Saturday, August 6, 2016

Ubuntu: Monitor hardware RAID and notify upon failure?



I am using the 3ware 9650SE-2LP Raid controller for a 2-drive RAID 1 setup in some new Ubuntu 10.04 x64 servers.




Is there a way for the server to send me a notification when one of the drives fails? I would prefer an e-mail notification if possible. Thanks.


Answer



3ware provides 3dm2 monitoring / management program. just look onm their webpage, there is a binary version of it for linux, and it even works fine [under debian at least].



thing is - i never trusted those fancy tools... so i do as follows. so i use own scripts based on tw_cli - also downloadable from 3ware website.



once per week i run patrol read:



./tw_cli /c0/u0 start verify



and all the time, every 15 minutes i dump current state of raid:



./tw_cli /c0 show > current.txt


i use very simple nagios plugin to check if current status is identical to expected [ i just compare content of a file to well known status dump that was taken at the beginning ].



#!/bin/bash


if [ `diff current.txt expected.txt|wc -l` -ne 0 ] ; then
echo "CRITICAL - current state of raid does not match expected pattern "
exit 2
fi

if [ `find . -name current.txt -mmin -16|wc -l` -ne 1 ] ; then
echo "CRITICAL - state file is old "
exit 2
fi
echo "OK"

exit 0


you would probably put mailing instead of exit 2... or even more probably use 3dm2.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...