#!/bin/bash
#check raid disk status
megacli="/opt/MegaRAID/MegaCli/MegaCli64 "
STATUS=`$megacli -LDInfo -LALL -aAll|grep -i State | awk -F ': ' '{print $2}'`
#if [ $STATUS == "Degraded" ]; then
if [ $STATUS != "Optimal" ]; then
        echo -e "Host   : SERVER-xxx `$megacli -LDInfo -LALL -aAll|grep -i State` \n.\n" | mail -s 'Your Server RAID is DEGRADED!!' xxx@leeyc.com
fi