下载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卡脚本:

   
   
   
   
  1. #!/bin/sh  
  2. #$Id: check_perc5i.sh $  
  3. #creater:wangwei  
  4. #Check RAID Card PERC 5/i VD and PD State  
  5. #Redhat5 32 bit use command MegaCli  
  6. #Redhat5 64 bit use command MegaCli64  
  7. HOSTNAME=`/bin/hostname`  
  8. CARD=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL |grep "Product Name" | cut -d ':' -f2`  
  9. VDSTATE1=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL | grep "State"`  
  10. VDSTATE2=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep "Degraded"`  
  11. VDSTATE3=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep "  Offline"`  
  12. PDSTATE1=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL | grep "Online" | wc -l | sed 's/       //'`  
  13. PDSTATE2=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL | grep "Rebuild" | wc -l | sed 's/       //'`  
  14. PDSTATE3=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep "Critical Disks"`  
  15. PDSTATE4=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep "Failed Disks"`  
  16. PDSTATE5=`/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aAll|egrep "Error|Device Id"`  
  17. PDSTATE6=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL|egrep "Device Id|Firmware state" |sed 'N;s/\nFirmware state:/  /'`  
  18. power1=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Full Charge Capacity:"|awk '{print $4}'`  
  19. power2=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Remaining Capacity:"|awk '{print $3}'`  
  20. #percent=`echo 'scale=2;'${power2}'*100/'${power1}''|bc -l`  
  21. percent=`echo $((${power2}*100/${power1}))`  
  22. echo "====Host Information:" 
  23. echo "" 
  24. echo "Host              : $HOSTNAME" 
  25. echo "Raid Card         :$CARD" 
  26. echo "" 
  27. echo "====Power usage:" 
  28. echo "" 
  29. echo "The remaining power:" $percent"%" 
  30. echo "" 
  31. echo "====Virtual Disk State:" 
  32. echo "" 
  33. echo "Virtual Disk $VDSTATE1" 
  34. echo "$VDSTATE2" 
  35. echo "$VDSTATE3" 
  36. echo "" 
  37. echo "====Physical Disk State:" 
  38. echo "" 
  39. echo "$PDSTATE6" 
  40. echo "Online Disk       : $PDSTATE1" 
  41. echo "Rebuild Disk      : $PDSTATE2" 
  42. echo "$PDSTATE3" 
  43. echo "$PDSTATE4" 
  44. echo "" 
  45. echo "====Physical Disk Error:" 
  46. echo "" 
  47. echo "$PDSTATE5" 
  48. echo "" 
  49.  
  50. #查raid卡信息:  
  51. #/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL  
  52. #riad查看电池的信息:  
  53. #/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL  
  54. #电池剩余:/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Remaining Capacity:"|awk '{print $3}' 
  55. #电池总量:/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Full Charge Capacity:"|awk '{print $4}' 
  56. #查看riad卡的日志:  
  57. #/opt/MegaRAID/MegaCli/MegaCli64  -fwtermlog -dsply -a0  
  58. #查看硬盘信息:  
  59. #/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aAll