软件环境:
OS:CentOS 5.X/6.X
软件:mail/hpacucli
检测脚本:
Raid_monitor.sh:
- #/bin/sh
- #get the Raid status
- /usr/sbin/hpacucli ctrl all show config > /tmp/raidstatus.txt
- #set the Variables
- Check_Hour="`date +%m%d-%H`"
- Disk_Num=5
- Mail_Add=noc@domain.com
- Subject="`hostname` Raid Alarm!!"
- Statusfile="/tmp/raidstatus.txt"
- OK_Num=`grep OK $Statusfile|wc -l`
- #Alarms
- if [ $OK_Num -le $Disk_Num ];then
- mail -s "$Subject" $Mail_Add < $Statusfile
- else
- echo "$Check_Hour `hostname`'s Raid Status is OK"
- fi
- exit 0;
频率设定:
- 0 */6 * * * /home/Raid_monitor.sh >> /home/Raid_status.log
转载于:https://blog.51cto.com/cncto/981958