下载MegaCli-1.01.39-0.i386.rpm(其他的版本也一样),安装rpm -ivh MegaCli-1.01.39-0.i386.rpm,然后在/opt/MegaRAID/MegaCli/目录下,有个MegaCli64(32位系统下为:MegaCli) 命令。
以下列举一些常用命令:
命令使用:
MegaCli -LDInfo -Lall -aALL 查raid级别
MegaCli -AdpAllInfo -aALL 查raid卡信息
MegaCli -PDList -aALL 查看硬盘信息
MegaCli -AdpBbuCmd -aAll 查看电池信息
MegaCli -FwTermLog -Dsply -aALL 查看raid卡日志
MegaCli常用参数介绍
MegaCli -adpCount 【显示适配器个数】
MegaCli -AdpGetTime –aALL 【显示适配器时间】
MegaCli -AdpAllInfo -aAll 【显示所有适配器信息】
MegaCli -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
MegaCli -PDList -aAll 【显示所有的物理信息】
MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
MegaCli -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
MegaCli -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
MegaCli -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
MegaCli -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】
Linux下监控戴尔RIAD卡脚本:
- #!/bin/sh
- #$Id: check_perc5i.sh $
- #creater:wangwei
- #Check RAID Card PERC 5/i VD and PD State
- #Redhat5 32 bit use command MegaCli
- #Redhat5 64 bit use command MegaCli64
- HOSTNAME=`/bin/hostname`
- CARD=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL |grep "Product Name" | cut -d ':' -f2`
- VDSTATE1=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL | grep "State"`
- VDSTATE2=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep "Degraded"`
- VDSTATE3=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep " Offline"`
- PDSTATE1=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL | grep "Online" | wc -l | sed 's/ //'`
- PDSTATE2=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL | grep "Rebuild" | wc -l | sed 's/ //'`
- PDSTATE3=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep "Critical Disks"`
- PDSTATE4=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep "Failed Disks"`
- PDSTATE5=`/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aAll|egrep "Error|Device Id"`
- PDSTATE6=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL|egrep "Device Id|Firmware state" |sed 'N;s/\nFirmware state:/ /'`
- power1=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Full Charge Capacity:"|awk '{print $4}'`
- power2=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Remaining Capacity:"|awk '{print $3}'`
- #percent=`echo 'scale=2;'${power2}'*100/'${power1}''|bc -l`
- percent=`echo $((${power2}*100/${power1}))`
- echo "====Host Information:"
- echo ""
- echo "Host : $HOSTNAME"
- echo "Raid Card :$CARD"
- echo ""
- echo "====Power usage:"
- echo ""
- echo "The remaining power:" $percent"%"
- echo ""
- echo "====Virtual Disk State:"
- echo ""
- echo "Virtual Disk $VDSTATE1"
- echo "$VDSTATE2"
- echo "$VDSTATE3"
- echo ""
- echo "====Physical Disk State:"
- echo ""
- echo "$PDSTATE6"
- echo "Online Disk : $PDSTATE1"
- echo "Rebuild Disk : $PDSTATE2"
- echo "$PDSTATE3"
- echo "$PDSTATE4"
- echo ""
- echo "====Physical Disk Error:"
- echo ""
- echo "$PDSTATE5"
- echo ""
- #查raid卡信息:
- #/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL
- #riad查看电池的信息:
- #/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL
- #电池剩余:/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Remaining Capacity:"|awk '{print $3}'
- #电池总量:/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Full Charge Capacity:"|awk '{print $4}'
- #查看riad卡的日志:
- #/opt/MegaRAID/MegaCli/MegaCli64 -fwtermlog -dsply -a0
- #查看硬盘信息:
- #/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aAll