OVH Community, your new community space.

script check hardware raid
20-06-2015, 09:25
i have a server with raid hardware.
I want to check disk/raid status, so that if there is a problem send an alert (email)
in that case i can move VM on other server and boot in rescue mode, open ticket, ecc...
On server runs proxmox (official ovh distro)

Reading OVH guide, i founf this command
# MegaCli -AdpAllInfo -aALL
and works because i see "raid status OK"
so i think to do this script e "cron" it every hour

cd /root/
MegaCli -AdpAllInfo -aALL | grep "Degraded" > degraded.txt
MegaCli -AdpAllInfo -aALL | grep "Failed" >> degraded.txt
cat degraded.txt | grep "1" > /dev/null
if [[ $? -eq 0 ]];
cat degraded.txt | mailx -s 'Degraded RAID on '$HOSTNAME
in this case i receive an email when script find a word Degraded or Failed

i configured also smartools for a more security...
If you this script is correct? or is possibile improve it?

thank you in advance