分类: LINUX
2013-09-03 16:39:01
#!/bin/sh
Hostname=`/bin/hostname`
Hostip=`awk -F= ‘/IPADDR/ {print $2}’ /etc/sysconfig/network-scripts/ifcfg-eth0`
Battery=`/opt/MegaCli -AdpBbuCmd -GetBbuStatus -aALL|grep “Charger Status”|awk -F: ‘{print $1″ :”$2}’`
raid=`/opt/MegaCli -cfgdsply -aALL|grep “RAID Level”|tail -1|awk -F: ‘{print $1″ :”$2}’`
Disknum=`/opt/MegaCli -cfgdsply -aALL|grep -c “Non Coerced Size”`
Onlinedisk=`/opt/MegaCli -cfgdsply -aALL | grep “Online” | wc -l | sed ‘s/ //’`
Faileddisk=`/opt/MegaCli -AdpAllInfo -aALL | grep “Failed Disks”|awk -F’ ‘ ‘{print $4}’`
echo “####################### Host Information #########################”
echo “HostName : $Hostname”
echo “HostIp : $Hostip”
echo “”
echo “####################### Raid Information ########################”
#echo “$Raidmode”
case “$raid”
in
“RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0″) echo “Raid Level :Raid 1″;;
“RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0″) echo “Raid Level :Raid 0″;;
“RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3″) echo “Raid Level :Raid 5″;;
“RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0″) echo “Raid Level :Raid 10″;;
esac
if [ -z "$Battery" ];then
echo “Battery :Null”
else
echo “$Battery”
fi
echo “Total Diak Number:$Disknum”
echo “Online Disk Number:$Onlinedisk”
echo “Failed Disk Number:$Faileddisk”
echo “”
磁带状态的变化,从拔盘,到插盘的过程中:
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online
MegaCLI安装:
DELL PERC 6/I-R-E阵列卡使用的是芯片,所以可以使用LSI MegaCLI对阵列卡进行在线管理.
MegaCLI下载:
MegaCLI安装(我下载是8.00.29_Linux_MegaCli.zip): 选择合适的型号一般通用
unzip 8.00.29_Linux_MegaCli.zip
unzip MegaCliLin.zip
rpm -ivh Lib_Utils-1.00-08.noarch.rpm
rpm -ivh MegaCli-8.00.29-1.i386.rpm
cd /opt/MegaRAID/MegaCli/
默认安装在/opt/MegaRAID/MegaCli目录,对行的执行文件是:
32位: /opt/MegaRAID/MegaCli/MegaCli
64位: /opt/MegaRAID/MegaCli/MegaCli64
# rpm -ql MegaCli (确认MegaCli包的安装文件信息)
/opt/MegaRAID/MegaCli/MegaCli
/opt/MegaRAID/MegaCli/MegaCli64
如果是32bit系统, 就使用MegaCli; 如果是64bit系统就是使用MegaCli64.
# /opt/MegaRAID/MegaCli/MegaCli (该命令直接执行会提示如下错误)
or
# /opt/MegaRAID/MegaCli/MegaCli64 (该命令直接执行会提示如下错误)
Fatal error - Command Tool invoked with wrong parameters
Exit Code: 0x01
MegaCli工具的安装命令:
rpm -ivh MegaCli-1.01.24-0.i386.rpm
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 1.086 TB
State : Optimal
Strip Size : 128 KB
Number Of Drives per span:4 //表示每4个物理盘做成一个RAID1盘组
Span Depth : 2 //表示共2个RAID1盘组做成了RAID10