MegaCli 监控raid状态

MegaCli是一款管理维护硬件RAID软件,可以通过它来了解当前raid卡的所有信息,包括 raid卡的型号,raid的阵列类型,raid 上各磁盘状态,等等。通常,我们对硬盘当前的状态不太好确定,一般通过机房人员巡检来完成,有没有通过软件的方式来检查确定这个问题呢。MegaCli就可以做到,一般通过 MegaCli 的Media Error Count: 0 Other Error Count: 0 这两个数值来确定阵列中磁盘是否有问题;Medai Error Count 表示磁盘可能错误,可能是磁盘有坏道,这个值不为0值得注意,数值越大,危险系数越高,Other Error Count 表示磁盘可能存在松动,可能需要重新再插入。MegaCli 可以对阵列中所有的磁盘进行检测,我们可以通过脚本的方式来检测相关参数,从而通知管理人员。

一、 下载MegCli,目前针对公司DB数据库是IBM的服务器,直接从IBM官方下载,如果

其它服务器的,使用各官方下载或者 LSI网站上进行相关下载。一般来说,是通用的。这个包适用32 /64位操作系统平台

下载地址:ftp://download2.boulder.ibm.com/ecc/sar/CMA/XSA/ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip

二、 安装

#unzip ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip

#cd linux

# rpm -ivh Lib_Utils-1.00-09.noarch.rpm  MegaCli-8.00.48-1.i386.rpm

三 使用命令及参数

命令使用:
#/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 查raid级别
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL 查raid卡信息
#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL 查看硬盘信息
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll 查看电池信息
#/opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog -Dsply -aALL 查看raid卡日志
#/opt/MegaRAID/MegaCli/MegaCli64 -adpCount 【显示适配器个数】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpGetTime –aALL 【显示适配器时间】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAll 【显示所有适配器信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll 【显示所有的物理信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
#/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】
3.磁带状态的变化,从拔盘,到插盘的过程中。
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online
4.查看磁盘缓存策略
#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L0 -a0
or
#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L1 -a0
or
#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL -a0
ro
#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL -aALL
ro
#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -DskCache -LALL -aALL
5.设置磁盘缓存策略
缓存策略解释:

WT (Write through
WB (Write back)
NORA (No read ahead)
RA (Read ahead)
ADRA (Adaptive read ahead)
Cached
Direct
例子:
#/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0
or
#/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Cached|-Direct -L0 -a0
or
enable / disable disk cache
#/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -EnDskCache|-DisDskCache -L0 -a0
6.创建一个 raid5 阵列,由物理盘 2,3,4 构成,该阵列的热备盘是物理盘 5
#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0
7.创建阵列,不指定热备
#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0
8.删除阵列
#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L1 -a0
9.在线添加磁盘
#/opt/MegaRAID/MegaCli/MegaCli64 -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0
10.阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。
#/opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
#/opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ProgDsply -LALL -aALL
11.查看阵列后台初始化进度
#/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
#/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ProgDsply -LALL -aALL
12.指定第 5 块盘作为全局热备
#/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
13.指定为某个阵列的专用热备
#/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
14.删除全局热备
#/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Rmv -PhysDrv[1:5] -a0
15.将某块物理盘下线/上线
#/opt/MegaRAID/MegaCli/MegaCli64 -PDOffline -PhysDrv [1:4] -a0
#/opt/MegaRAID/MegaCli/MegaCli64 -PDOnline -PhysDrv [1:4] -a0
16.查看物理磁盘重建进度
#/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv [1:5] -a0
或者以动态可视化文字界面显示
#/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ProgDsply -PhysDrv [1:5] -a0

磁带状态的变化,从拔盘,到插盘的过程中:
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online

1、 查看RAID级别

2、 查看RAID卡信息,主要输出RAID卡的一些配置信息

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

3、 查看所有硬盘的信息

/opt/MegaCli64  -pdlist –aALL

4、 查看当前raid缓存状态,raid缓存状态设置为wb的话要注意电池放电事宜,设置电池放电模式为自动学习模式

/opt/MegaRAID/MegaCli/MegaCli64   -ldgetprop  -dskcache -lall  -aall

5、 raid 电池设置相关

查看电池状态信息(Display BBU Status Information)
MegaCli -AdpBbuCmd -GetBbuStatus -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuStatus -aALL

查看电池容量(Display BBU Capacity Information)
MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuCapacityInfo –aALL

查看电池设计参数(Display BBU Design Parameters)
MegaCli -AdpBbuCmd -GetBbuDesignInfo -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuDesignInfo –aALL

查看电池属性(Display Current BBU Properties)
MegaCli -AdpBbuCmd -GetBbuProperties -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuProperties –aALL

设置电池为学习模式为循环模式(Start BBU Learning Cycle)
Description Starts the learning cycle on the BBU.
No parameter is needed for this option.
MegaCli -AdpBbuCmd -BbuLearn -aN|-a0,1,2|-aALL

设置磁盘的缓存模式和访问方式 (Change Virtual Disk Cache and Access Parameters)
Description Allows you to change the following virtual disk parameters:
-WT (Write through), WB (Write back): Selects write policy.
-NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy.
-Cached, -Direct: Selects cache policy.
-RW, -RO, Blocked: Selects access policy.
-EnDskCache: Enables disk cache.
-DisDskCache: Disables disk cache.
MegaCli -LDSetProp { WT | WB|NORA |RA | ADRA|-Cached|Direct} |
{-RW|RO|Blocked} |
{-Name[string]} |
{-EnDskCache|DisDskCache} –Lx |
-L0,1,2|-Lall -aN|-a0,1,2|-aALL
MegaCli -LDSetProp WT -L0 -a0

显示磁盘缓存和访问方式(Display Virtual Disk Cache and Access Parameters)
MegaCli -LDGetProp -Cache | -Access | -Name | -DskCache -Lx|-L0,1,2|
-Lall -aN|-a0,1,2|-aALL
Displays the cache and access policies of the virtual disk(s):
-WT (Write through), WB (Write back): Selects write policy.
-NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy.
-Cache, -Cached, Direct: Displays cache policy.
-Access, -RW, -RO, Blocked: Displays access policy.
-DskCache: Displays physical disk cache policy.

Megaraid 必知必会 使用LSI的megaraid可以对raid进行有效监控。别的厂商比如HP,IBM也有自己的raid API
MegaCli -ldinfo -lall -aall
查询raid级别,磁盘数量,容量,条带大小。
MegaCli -cfgdsply -aALL |grep Policy
查询控制器cache策略
MegaCli -LDSetProp WB -L0 -a0
设置write back功能
MegaCli -LDSetProp CachedBadBBU -L0 -a0
设置即使电池坏了还是保持WB功能
MegaCli -AdpBbuCmd -BbuLearn a0
手动充电
MegaCli -FwTermLog -Dsply -aALL
查询日志

显示适配器个数: MegaCli -adpCount

显示所有适配器信息: MegaCli -AdpAllInfo -aAll
Critical Disks : 0
Failed Disks : 0

显示所有逻辑磁盘组信息: MegaCli -LDInfo -LALL -aAll
显示所有的物理信息: MegaCli -PDList -aAll
Media Error Count: 0
Other Error Count: 0

查看充电状态: MegaCli -AdpBbuCmd -GetBbuStatus -aALL
Learn Cycle Requested : No
Fully Charged : Yes

显示BBU(后备电池)状态信息: MegaCli -AdpBbuCmd -GetBbuStatus -aALL
显示BBU容量信息: MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aALL
显示BBU设计参数: MegaCli -AdpBbuCmd -GetBbuDesignInfo -aALL
显示当前BBU属性: MegaCli -AdpBbuCmd -GetBbuProperties -aALL
显示Raid卡型号,Raid设置,Disk相关信息: MegaCli -cfgdsply -aALL
查看Cache 策略设置: MegaCli -cfgdsply -aALL |grep -i Policy
Current Cache Policy: WriteBack, ReadAheadNone, Direct, Write Cache OK if Bad BBU
查看充电进度百分比: MegaCli -AdpBbuCmd -GetBbuStatus -aALL

各种设备和磁盘的不同状态:
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online

6、 通过脚本检测RAID 磁盘状态

Linux下脚本

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
#check raid disk status
MEGACLI="/opt/MegaRAID/MegaCli/MegaCli64 "
 
$MEGACLI -pdlist -aALL  | grep "Firmware state" | awk -F : '{print $2}' | awk -F , '{print $1}' >/tmp/fireware.log
 
$MEGACLI -pdlist -aALL  | grep -E "Media Error|Other Error" | awk -F : '{print $2}' >/tmp/disk.log
 
for i in `cat < /tmp/disk.log`
do
 
if [ $i -ne 0 ]
then
curl "http://xxxxxxB&state=ALARM&description=raid_disk_error"
fi
 
done
 
for i in `cat < /tmp/fireware.log`
do
 
if [ $i !=  Online ]
then
curl "http://xxxxxxstate=ALARM&description=raid_disk_offline"
fi
 
done

Windows 下脚本

Windows下脚本用的工具是gnu for windows平台的一些软件,如 bash grep awk cat

通过bash直接调用脚本

如:G:\raid_check\unixtools>bash.exe  G:\disk.sh

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#check raid disk status
MEGACLI="//G/raid_check/MegaCli.exe"
GREP="//G/raid_check/unixtools/grep.exe"
AWK="//G/raid_check/unixtools/awk.exe"
CAT="//G/raid_check/unixtools/cat.exe"
CURL="//G/raid_check/unixtools/curl.exe"
 
$MEGACLI -pdlist -aALL  | $GREP "Firmware state" |$AWK -F: '{print $2}' |$AWK -F , '{print $1}' >//c/fireware.log
 
$MEGACLI -pdlist -aALL  | $GREP -E "Media Error|Other Error" | $AWK -F : '{print $2}' > //c/disk.log
 
for i in `$CAT c:/disk.log`
do
 
if [ $i -ne 0 ]
then
$CURL "http://xxxxxx&description=raid_disk_error"
fi
 
done
 
for i in `$CAT c:/fireware.log`
do
if [ $i != Online ]
then
$CURL "http://xxxxx&state=ALARM&description=raid_disk_offline"
fi

在UC上看到一篇文章挺详细的,转载下

转自:http://blog.chinaunix.net/uid-25135004-id-3139293.html
本站整理:http://www.ttlsa.com/html/3121.html

HP服务器什么都查不出

MegaCli 监控raid状态 限戴尔服务器的更多相关文章

  1. MegaCli 监控raid状态

    MegaCli 监控raid状态 http://blog.chinaunix.net/uid-25135004-id-3139293.html 简介 MegaCli是一款管理维护硬件RAID软件,可以 ...

  2. 戴尔服务器使用omreport(OMSA)查看监控硬件信息

    安装OMSA wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash yum install -y n ...

  3. 戴尔服务器R710做raid5+1

    环境条件 戴尔服务器R710,有四块硬盘 实现目标:四块硬盘其中三块做raid5,剩余一块做热备硬盘 一.启动服务器 二.进入配置raid界面 根据提示按Crtl+R 进入raid配置界面 三.界面介 ...

  4. 戴尔服务器ipmi报错

    戴尔服务器ipmi配置完成,用浏览器打开报错 查看器已终止,网络已中断 原因:这个问题是java报错,用火狐打开报错 解决方法: 用IE打开就没问题,IE要用较高版本的,楼主的是win10-IE11

  5. 戴尔服务器如何配置远程管理卡(IDRAC9)适用于戴尔R740服务器

    戴尔服务器如何配置远程管理卡(IDRAC9)适用于戴尔R740服务器 转: DELL IDRAC9 该配置方法适合于所有戴尔14G服务器,包括全系列戴尔服务器,标准版适用于R440/R540/R640 ...

  6. 通过监控线程状态来保证socket服务器的稳定运行

    云平台中使用的socket服务器是我们自己定义一套通信协议,并通过C#实现的一个socket服务. 该服务目前是和web服务一起运行在IIS容器中,通过启动一个永不退出的新线程来监听端口. 在开发的初 ...

  7. MegaCli监控RAID磁盘健康信息

    首先有必要先介绍一下有关RAID卡的使用,有关Cache问题也有个人理解:生产系统上的物理机磁盘配置大多都是RAID5,之前会经常性的遇到磁盘IO在某个时间极度的跟不上节奏,稍微写入量,磁盘utils ...

  8. 戴尔服务器H330阵列卡取消磁盘阵列教程

    一:服务器开机看到ctrl+R提示,按ctrl+r进入阵列卡配置界面 二:按ctrl+N 转到PD Mgmt查看硬盘信息,确认硬盘状态:Ready 三:光标移到需配置硬盘上,按F2,选择 conver ...

  9. 戴尔服务器IDRAC命令配置IP地址

    在工作中我们可能会遇到,在配置管理卡的时候,由于疏忽,把网关配置错误(但是你肯定的是IP没有错),导致不能正常连接管理卡,这是有两个办法,第一:你去机房,进行查看进行修改,第二:你登陆交换机,从交换机 ...

随机推荐

  1. linux下常用FTP命令 1. 连接ftp服务器

    1. 连接ftp服务器 格式:ftp [hostname| ip-address] a)在linux命令行下输入: ftp 192.168.1.1 b)服务器询问你用户名和密码,分别输入用户名和相应密 ...

  2. c++ time_t

    type struct tm <ctime> Time structure Structure containing a calendar date and time broken dow ...

  3. <OC>OC新特征array literals

    类似于java5提供的autoboxing功能.以前的写法:NSNumber * number = [NSNumber numberWithInt:1];NSArray * array = [NSAr ...

  4. 【算法】CRF

    http://www.open-open.com/doc/view/7e983c0bf1594849bcd088dc212098c4 http://wenku.baidu.com/link?url=c ...

  5. win7笔记本电脑怎么做wifi热点

    win7设置wifi热点后非常方便,可以给其他笔记本和手机之类支持无线上网的移动设备使用,接下来请看超简单的详细设置方法. 方法/步骤 1 第一步先打开“控制面板” 2 点击“网络和Internet” ...

  6. [ACM] poj 2017 Speed Limit

    Speed Limit Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 17030   Accepted: 11950 Des ...

  7. mybatis由浅入深day02_7查询缓存_7.2一级缓存_一级缓存应用

    7 查询缓存 7.1 什么是查询缓存 mybatis提供查询缓存,用于减轻数据压力,提高数据库性能. mybaits提供一级缓存,和二级缓存. 一级缓存是SqlSession级别的缓存.在操作数据库时 ...

  8. 京东云擎”本周四推出一键免费安装Discuz论坛

    “京东云擎”本周四推出一键免费安装Discuz论坛了,让用户能在1分钟之内建立自己的论坛.这是继上周云擎推出一键安装WordPress之后的又一重大免费贡献! 云擎: http://jae.jd.co ...

  9. 【RF库Collections测试】Dictionary Should Contain Value

    Name:Dictionary Should Contain ValueSource:Collections <test library>Arguments:[ dictionary | ...

  10. ZooKeeper(七)-- ZK原生API实现分布式锁

    一.使用场景 在分布式应用,往往存在多个进程提供同一服务.这些进程有可能在相同的机器上,也有可能分布在不同的机器上. 如果这些进程共享了一些资源,可能就需要分布式锁来锁定对这些资源的访问. 二.实现分 ...