资源描述
这俩周配置raid卡监控,小有心得,拿出来分享下
目前市面上主流的raid卡,主要是lsi的和adaptec
Lsi的里边也有分不过目前主流的是megaraid raid卡
通过lspci|grep megaraid 可以发现
他的管理主要是通过megaraid storage manage 这个管理软件实现图形化的管理,及邮件监控
也有通过安装megacli包,这个包安装完成后,可以通过命令行模式,查出raid卡监控,可以通过megecli + nagios的方式 实现监控。脚本这些网上很多,我这里就不详细描述了。
下面是重点:adaptec的raid 卡监控
我们服务器是文本模式的linux ,通过adaptec storage manager无法完成对这种服务器的邮件监控(图形的可以)。我们的raid卡,是2130slp 无法通过arcconf 这种方式,没有对linux的支持
研究adaptec storage manager 各种文件,发现邮件配置是以2进制写成,本来打算在虚拟机上模拟服务器上的主机,ip 完了,通过图形界面更改了邮件配置,将这种配置文件拷贝出来,覆盖服务器上的文件,最后没有测试。
刚好,我们有台这种服务器出现了问题。发现RaidEvat.log日志,每15分钟更新一次,记录时间,raid卡的报错信息。
所以写了如下的脚本,用来监控
脚本监控.log的增长,raid卡出现问题后,大概1小时发送一次邮件。
不排除误报,服务器重启会增加一条log日志,连续5次重启,会误报一次
#!/bin/bash
count=1
a=`ls -l /usr/StorMan/RaidEvtA.log |awk -F" " '{print $5}'`
while :
do
b=`ls -l /usr/StorMan/RaidEvtA.log |awk -F" " '{print $5}'`
text=`sudo tail -n 5 /usr/StorMan/RaidEvtA.log`
IP=`/sbin/ifconfig | awk '{if ( $1 == "inet" && $3 ~ /^Bcast/) print $2}' | cut -f2 -d ":"`
#echo $count
#echo $a
#echo $b
#clear
if (($b>$a))
then
count=$(($count+1));
a=$b;
fi
if (($count>4))
then
sudo /usr/sbin/sendmail -t <<EOF
from: dbauser2@
to:servermonitor@
subject: Raid card warning $hostname;
something error with raid
please check /usr/StorMan/RaidEvtA.log
the machine is $hostname;
ip is:
$IP;
$text
EOF
sudo /usr/sbin/sendmail -t <<EOF
from: dbauser2@
to:yangchunyu@
subject: Raid card warning $hostname;
something error with raid
please check /usr/StorMan/RaidEvtA.log
the machine is $hostname;
ip is:
$IP;
$text
EOF
count=1;
fi
sleep 6000
done
展开阅读全文