MegaRAID信息查看

#查raid卡信息(生产商、电池信息及所支持的raid级别)
/usr/local/sbin/MegaCli -AdpAllInfo -aALL |grep -E "Product Name|BBU|Memory Size|RAID Level Supported" #查看虚拟化(vd)和物理盘(pd)的信息,比如查看物理硬盘数,是否有硬盘offline或者degraded
/usr/local/sbin/MegaCli -AdpAllInfo -aALL |grep -E "Device Present" -A9 ## 查看RAID日志
/usr/local/sbin/MegaCli -FwTermLog dsply –aAll #查看硬盘是否online
/usr/local/sbin/MegaCli -PDList -aALL |grep "Firmware state" #查看硬盘是否存在物理错误(error不为0,可能会有硬盘故障即将发生)
/usr/local/sbin/MegaCli -PDList -aALL |grep -i error #查看电池信息(电池类型、电池状态、充电状态、温度等)
/usr/local/sbin/MegaCli -AdpBbuCmd -aAll #raid卡个数
/usr/local/sbin/MegaCli -adpCount #显示所有逻辑磁盘组信息(做了几组raid,raid cache的默认和当前策略,做好raid后的虚拟盘容量)
/usr/local/sbin/MegaCli -LDInfo -LALL -aAll #显示所有物理盘(物理磁盘个数、大小、是否存在error)
/usr/local/sbin/MegaCli -PDList -aAll #显示所有物理盘物理错误
/usr/local/sbin/MegaCli -PDList -aAll |grep -i error #查看充电状态
/usr/local/sbin/MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep 'Charger Status' ##查看BBU设置
/usr/local/sbin/MegaClii -AdpBbuCmd -GetBbuProperties -aALL ## 查看当前BBU状态
/usr/local/sbin/MegaClii -AdpBbuCmd -GetBbuStatus -aALL #显示BBU状态信息,比如电池是否,如果issohgood为Yes为正常,No为异常
/usr/local/sbin/MegaCli -AdpBbuCmd -GetBbuStatus -aALL|grep -i issohgood #显示Raid卡型号,cache大小、Raid设置,cache策略、Disk相关信息
/usr/local/sbin/MegaCli -cfgdsply -aALL |egrep "PDs|VDs|Product Name|Memory|BBU:" #磁带状态的变化,从拔盘,到插盘的过程中。
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online #查看磁盘缓存策略(查看vd的)
/usr/local/sbin/MegaCli -LDGetProp -Cache -LALL -aALL #或者(查看pd的) #/usr/local/sbin/MegaCli -LDGetProp -DskCache -LALL -aALL #缓存策略解释: WT (Write through
WB (Write back)
NORA (No read ahead)
RA (Read ahead)
ADRA (Adaptive read ahead)
Cached
Direct
例子: #查看物理磁盘重建进度
/usr/local/sbin/MegaCli -PDRbld -ShowProg -PhysDrv [1:5] -a0
或者以动态可视化文字界面显示
/usr/local/sbin/MegaCli -PDRbld -ProgDsply -PhysDrv [1:5] -a0 #磁带状态的变化,从拔盘,到插盘的过程中:
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online

HP RAID信息查看

## 查看控制器编号
hpacucli ctrl all show status |egrep 'Smart Array' ## 看出slot=0控制卡的信息
hpacucli ctrl slot=0 show config detail ## 看出slot=0缓存信息
hpacucli ctrl slot=0 show config detail | grep -i 'cache'

MegaRAID修改写缓存

## 强制在BBU损坏时使用Cache
/usr/local/sbin/MegaCli -LDSetProp CachedBadBBU -Lall -aALL ## 强制使用WriteBack写策略
/usr/local/sbin/MegaCli -LDSetProp WB -Lall -aALL

HP RAID修改写缓存

## 关闭slot=0上物理磁盘缓存
hpssacli ctrl slot=0 modify drivewritecache=disable ## 开启slot=0上逻辑磁盘缓存
hpssacli ctrl slot=0 logicaldrive 2 modify caching=enable ## 开启slot=0上逻辑磁盘在BBU损坏时缓存
hpssacli ctrl slot=0 modify nobatterywritecache=enable

简易版的RAID检查脚本:

#!/bin/bash

##====================================================##
## 服务器信息 ##
server_vendor=`dmidecode -s system-manufacturer|sed '/^#/d'|awk '{print $1}'`
server_ip=`ip addr sh|grep -v 'global secondary'|grep inet|grep -v 169.254|grep -v inet6|grep -v '127.0.0.1'|grep -v '172.172.170.11'|grep -v '172.16.0.11'|awk '{print $2}'|awk -F'/' '{print $1}'|head -n 1`
docker_flag=`ps -ef|grep "sleep 99999"|grep -v grep|wc -l`
os_version=`cat /etc/issue |head -1` if [ "${docker_flag}" == "1" ]
then
server_vendor="docker"
fi raid_product_name=''
raid_slot_id=''
raid_cache_size=''
raid_level=''
raid_size=''
raid_status=''
raid_bbu_count=''
raid_bbu_status=''
raid_cache_policy=''
raid_logic_drive_count=''
raid_logic_drive_error=''
raid_physical_drive_error=''
raid_physical_drive_type=''
raid_physical_drive_size=''
raid_physical_drive_count=''
raid_predictive_failure_count=''
log_file='./raid_info.txt' ##====================================================##
## 安装包信息 ##
hpacucli_rpm_url="http://xxxx.com/hpacucli-9.40-12.0.x86_64.rpm"
hpacucli_rpm_name="hpacucli-9.40-12.0.x86_64.rpm"
lib_utils_rpm_url="http://xxxx.com/Lib_Utils-1.00-09.noarch.rpm"
lib_utils_rpm_name="Lib_Utils-1.00-09.noarch.rpm"
megacli_rpm_url="http://xxxx.com/MegaCli-8.02.21-1.noarch.rpm"
megacli_rpm_name="MegaCli-8.02.21-1.noarch.rpm" ##====================================================##
## 高亮输出信息 ##
function echo_info()
{
message=$1
echo -e "\033[;37;32m ${message} \033[0m"
} function echo_error()
{
message=$1
echo -e "\033[;37;31m ${message} \033[0m"
}
##====================================================##
## 获取服务器ILO信息 ##
imm_idrac_mac=""
imm_idrac_ip=""
function get_imm_info()
{
if [[ "${server_vendor}" == "docker" ]]
then
echo_info "server is docker"
elif [[ "${server_vendor}" == "HP" ]]
then
imm_idrac_mac=`timeout 3s ipmitool -I open lan print 2|grep "MAC Address" |awk '{print $4}'`
imm_idrac_ip=`timeout 3s ipmitool -I open lan print 2 |grep -w "IP Address " |awk -F : '{print $2}'|sed 's/^ *//'`
elif [[ "${server_vendor}" == "LENOVO" ]]
then
imm_idrac_mac=`timeout 3s ipmitool -I open lan print 1|grep "MAC Address" |awk '{print $4}'`
imm_idrac_ip=`timeout 3s ipmitool -I open lan print 1 |grep -w "IP Address " |awk -F : '{print $2}'|sed 's/^ *//'`
elif [[ "${server_vendor}" == "INSPUR" ]]
then
imm_idrac_mac=`timeout 3s ipmitool -I open lan print 8|grep "MAC Address" |awk '{print $4}'`
imm_idrac_ip=`timeout 3s ipmitool -I open lan print 8 |grep -w "IP Address " |awk -F : '{print $2}'|sed 's/^ *//'`
else
imm_idrac_mac=`timeout 3s ipmitool -I open lan print 1|grep "MAC Address" |awk '{print $4}'`
imm_idrac_ip=`timeout 3s ipmitool -I open lan print 1 |grep -w "IP Address " |awk -F : '{print $2}'|sed 's/^ *//' `
fi
}
get_imm_info
echo_info "ILO_MAC:${imm_idrac_mac}"
echo_info "ILO_IP:${imm_idrac_ip}" ##====================================================##
## 安装HP服务器使用的hpssacli ## function install_hpssacli()
{
rpm_count=`rpm -qa |grep -i 'hpacucli' |wc -l`
if [ ${rpm_count} -gt 0 ]
then
echo_info 'hpacucli has been installed'
else
echo_info 'start to install hpacucli'
/bin/rm -f "/tmp/${hpacucli_rpm_name}"
wget -O "/tmp/${hpacucli_rpm_name}" "${hpacucli_rpm_url}"
rpm -ivh "/tmp/${hpacucli_rpm_name}" >/dev/null
echo_info 'end to install hpacucli'
fi
}
##====================================================##
## 安装服务器使用的MegaCli ##
function install_MegaCli()
{
rpm_count=`rpm -qa |grep 'Lib_Utils-' |wc -l`
if [ ${rpm_count} -gt 0 ]
then
echo_info 'Lib_Utils has been installed'
else
echo_info 'start to install Lib_Utils'
/bin/rm -f "/tmp/${lib_utils_rpm_name}"
wget -O "/tmp/${lib_utils_rpm_name}" "${lib_utils_rpm_url}"
rpm -ivh "/tmp/${lib_utils_rpm_name}"
echo_info 'end to install Lib_Utils'
fi rpm_count=`rpm -qa |grep 'MegaCli-' |wc -l`
if [ ${rpm_count} -gt 0 ]
then
echo_info 'MegaCli has been installed'
else
echo_info 'start to install Lib_Utils'
/bin/rm -f "/tmp/${megacli_rpm_name}"
wget -O "/tmp/${megacli_rpm_name}" "${megacli_rpm_url}"
rpm -ivh "/tmp/${megacli_rpm_name}"
echo_info 'end to install Lib_Utils'
fi
}
##====================================================##
## 安装服务器RAID使用的包 ##
function install_raid_rpm()
{
if [[ "${server_vendor}" == "docker" ]]
then
echo_info "server is docker"
elif [[ "${server_vendor}" == "HP" ]]
then
install_hpssacli
else
install_MegaCli
fi }
##====================================================##
## 安装服务器RAID使用的包 ## function get_hp_raid_info()
{
raid_product_name='HP'
raid_slot_id=`hpacucli ctrl all show status | grep 'Smart Array'|tail -n 1|awk '{ print $6 }'`
raid_cache_size=`hpacucli ctrl all show config detail |grep 'Total Cache Size'|awk -F ':' '{print $2}'`
raid_level=`hpacucli ctrl slot=${raid_slot_id} ld all show|grep -i 'raid' |awk -F ',' '{print $2}'`
raid_size=`hpacucli ctrl slot=${raid_slot_id} ld all show|grep -i 'raid' |awk -F '(' '{print $2}'|awk -F ',' '{print $1}'`
raid_status=`hpacucli ctrl all show config detail|grep 'Controller Status'|awk -F ':' '{print $2}'`
raid_bbu_count=`hpacucli ctrl all show config detail|grep 'Capacitor Count'|awk -F ':' '{print $2}'`
raid_bbu_status=`hpacucli ctrl all show config detail|grep 'Capacitor Status'|awk -F ':' '{print $2}'`
raid_cache_radio=`hpacucli ctrl all show config detail|grep 'Cache Ratio'| sed 's/:/ is/g'`
raid_cache_write_policy=`hpacucli ctrl all show config detail|grep 'No-Battery Write Cache' | sed 's/:/ is/g'`
raid_cache_policy="${raid_cache_radio},${raid_cache_write_policy}"
raid_logic_drive_count=`hpacucli ctrl all show status | grep 'Smart Array'|wc -l`
raid_logic_drive_error=`hpacucli ctrl slot=${raid_slot_id} ld all show| grep 'logicaldrive' |grep -v 'OK' |wc -l`
raid_physical_drive_error=`hpacucli ctrl slot=${raid_slot_id} physicaldrive all show| grep 'physicaldrive' |grep -v 'OK' |wc -l`
raid_physical_drive_type=`hpacucli ctrl slot=${raid_slot_id} physicaldrive all show| grep 'physicaldrive' |tail -n 1|awk -F ',' '{print $2}'`
raid_physical_drive_size=`hpacucli ctrl slot=${raid_slot_id} physicaldrive all show| grep 'physicaldrive' |tail -n 1|awk -F ',' '{print $3}'`
raid_physical_drive_count=`hpacucli ctrl slot=${raid_slot_id} physicaldrive all show| grep 'physicaldrive' |wc -l`
raid_predictive_failure_count=0
raid_error_count=0
if [[ "${raid_physical_drive_error}" != '0' ]]
then
raid_error_count=${raid_physical_drive_error}
fi
raid_warning_count=0 } function get_normal_raid_info()
{
raid_product_name=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL |egrep "Product Name" |awk -F ':' '{print $2}'`
raid_cache_size=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL |egrep "Memory" | awk -F ':' '{print $2}'`
raid_level=`/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL |grep 'RAID Level' |awk -F ':' '{print $2}'`
raid_size=`/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL |egrep '^Size'|tail -n 1 |awk -F ':' '{print $2}'`
raid_status=''
raid_bbu_count=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL |egrep '^BBU'|wc -l`
raid_bbu_status=`/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL |egrep '^BBU'|awk -F ':' '{print $2}'`
raid_cache_policy=`/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL |grep 'Current Cache Policy' |tail -n 1 |awk -F ':' '{print $2}'`
raid_logic_drive_count=`/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL |grep 'Target Id'|wc -l`
raid_logic_drive_error=0
raid_physical_drive_error=`/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL |grep -i 'error' | grep -v '0' |wc -l`
raid_physical_drive_type=`/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL |grep 'Media Type' |tail -n 1 |awk -F ':' '{print $2}' |awk -F '[' '{print $1 }'`
raid_physical_drive_size=`/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL |grep 'Raw Size' |tail -n 1 |awk -F ':' '{print $2}' |awk -F '[' '{print $1 }'`
raid_physical_drive_count=`/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL |grep 'Raw Size' |wc -l`
raid_span_depth=`/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL |egrep '^Span Depth'|tail -n 1 |awk -F ':' '{print $2}'|sed s/[[:space:]]//g`
match_result=$(echo ${raid_level} |grep "Primary-1") raid_error_count=`/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL |grep -i 'Firmware state' | grep 'Unconfigured(bad)' |wc -l`
raid_warning_count=`/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL |grep -i 'S.M.A.R.T alert' | grep -v ': No' |wc -l` raid_predictive_failure_count=`/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL |grep -i 'Predictive Failure Count' | grep -v ': 0' |wc -l` if [[ "${match_result}" != "" ]]
then
echo_info 'Primary-1'
if [[ "${raid_span_depth}" == "1" ]]
then
raid_level='RAID 1'
else
raid_level='RAID 10'
fi
fi
match_result=$(echo ${raid_level} |grep "Primary-5")
if [[ "${match_result}" != "" ]]
then
echo_info 'Primary-5'
if [[ "${raid_span_depth}" == "1" ]]
then
raid_level='RAID 5'
else
raid_level='RAID 50'
fi
fi
} function get_raid_info()
{
if [[ "${server_vendor}" == "docker" ]]
then
echo_info "server is docker"
elif [[ "${server_vendor}" == "HP" ]]
then
get_hp_raid_info
else
get_normal_raid_info
fi
} function write_raid_info()
{
echo "server_vendor:${server_vendor}" > "${log_file}"
echo "server_ip:${server_ip}" >> "${log_file}"
echo "os_version:${os_version}" >> "${log_file}"
echo "imm_idrac_mac:${imm_idrac_mac}" >> "${log_file}"
echo "imm_idrac_ip:${imm_idrac_ip}" >> "${log_file}"
echo "raid_product_name:${raid_product_name}" >> "${log_file}"
echo "raid_cache_size:${raid_cache_size}" >> "${log_file}"
echo "raid_level:${raid_level}" >> "${log_file}"
echo "raid_size:${raid_size}" >> "${log_file}"
echo "raid_status:${raid_status}" >> "${log_file}"
echo "raid_bbu_count:${raid_bbu_count}" >> "${log_file}"
echo "raid_bbu_status:${raid_bbu_status}" >> "${log_file}"
echo "raid_cache_policy:${raid_cache_policy}" >> "${log_file}"
echo "raid_logic_drive_count:${raid_logic_drive_count}" >> "${log_file}"
echo "raid_logic_drive_error:${raid_logic_drive_error}" >> "${log_file}"
echo "raid_physical_drive_error:${raid_physical_drive_error}" >> "${log_file}"
echo "raid_physical_drive_type:${raid_physical_drive_type}" >> "${log_file}"
echo "raid_physical_drive_size:${raid_physical_drive_size}" >> "${log_file}"
echo "raid_physical_drive_count:${raid_physical_drive_count}" >> "${log_file}"
echo "raid_error_count:${raid_error_count}" >> "${log_file}"
echo "raid_warning_count:${raid_warning_count}" >> "${log_file}"
echo "raid_predictive_failure_count:${raid_predictive_failure_count}" >> "${log_file}" } echo_info "get imm rpm"
get_imm_info
echo_info "install rpm"
install_raid_rpm
echo_info "get raid info"
get_raid_info
echo_info "write raid info to log"
write_raid_info
echo_info "#======================Server Info=======================##"
cat "${log_file}"
echo_info "#========================================================##"

MySQL Hardware--RAID卡常用信息查看的更多相关文章

  1. H3C 常用信息查看命令

  2. Linux中使用MegaCli工具查看、管理Raid卡信息

    MegaCli是一款管理维护硬件RAID软件,可以通过它来了解当前raid卡的所有信息,包括 raid卡的型号,raid的阵列类型,raid 上各磁盘状态,等等.通常,我们对硬盘当前的状态不太好确定, ...

  3. DELL磁盘阵列控制卡(RAID卡)MegaCli常用管理命令汇总

    新版本的 MegaCli-1.01.24-0.i386.rpm (下载地址:http://www.lsi.com/downloads/Public/MegaRAID Common Files/8.02 ...

  4. MySQL优化:使用show status查看MySQL服务器状态信息

    在网站开发过程中,有些时候我们需要了解MySQL的服务器状态信息,譬如当前MySQL启动后的运行时间,当前MySQL的客户端会话连接数,当前MySQL服务器执行的慢查询数,当前MySQL执行了多少SE ...

  5. 【MySQL优化】使用show status查看MySQL服务器状态信息

    在网站开发过程中,有些时候我们需要了解MySQL的服务器状态信息,譬如当前MySQL启动后的运行时间,当前MySQL的客户端会话连接数,当前MySQL服务器执行的慢查询数,当前MySQL执行了多少SE ...

  6. MySQL的备份与还原以及常用数据库查看命令

    MySQL命令行导出数据库: 1,进入MySQL目录下的bin文件夹:cd MySQL中到bin文件夹的目录 如我输入的命令行:cd C:\Program Files\MySQL\MySQL Serv ...

  7. vmware esxi 查看网卡、Raid卡驱动

    vmware esxi 查看网卡.Raid卡驱动 http://blog.51cto.com/adamcrab/1942763 查看网卡 [root@localhost:~] esxcfg-nics  ...

  8. MySql(十一):MySQL性能调优——常用存储引擎优化

    一.前言 MySQL 提供的非常丰富的存储引擎种类供大家选择,有多种选择固然是好事,但是需要我们理解掌握的知识也会增加很多.本章将介绍最为常用的两种存储引擎进行针对性的优化建议. 二.MyISAM存储 ...

  9. Linux RAID卡优化

    200 ? "200px" : this.width)!important;} --> 介绍 我们的生产服务器经常会做raid存储,但是单单做了raid就能保证性能高效和数据 ...

随机推荐

  1. 013 Enhancer创建动态代理

    在上一章使用了Enhancer,没有仔细说明代理的问题,在这一章进行详细的说明. 原本想使用cf包的,后来发现使用framework包下的包也没有问题,程序中就一直使用framework中的类. 一: ...

  2. openresty开发系列30--openresty中使用全局缓存

    openresty开发系列30--openresty中使用全局缓存 Nginx全局内存---本地缓存 使用过如Java的朋友可能知道如Ehcache等这种进程内本地缓存.Nginx是一个Master进 ...

  3. BDC里的 BDC_OKCODE

      BDC OKCODE其实都是function code,对于处理一些BDC问题 非常有用,   列出一些知道的 OKCODE BDC_OKCODE 功能描述 =/00.  Enter = /8   ...

  4. net::ERR_ABORTED 404 (Not Found)

    对于按需加载(on-demand-load)或加载外部资源(external resources)(如图片.文件等)来说,webpack的配置,output.publicPath是很重要的选项.如果指 ...

  5. Oracle Spatial 中的弧段及弧相关拓扑错误

    1.报告说明 此报告用于验证下列问题: ORACLE SPATIAL 0.05m的最小拓扑容差值是否可以被修改 原始数据通过ARCGIS入库数据精度是否有损失 修改ORACLE SPATIAL图层的最 ...

  6. spring security实现记住我下次自动登录功能

    目录 spring security实现记住我下次自动登录功能 一.原理分析 二.实现方式 2.1 简单实现方式 2.2 数据库实现方式 三.区分是密码登录还是rememberme登录 spring ...

  7. 关于最火爆的服务器Tomcat你真的了解吗?

    作为Apache 软件基金会的Jakarta 项目中的一个核心项目,Tomcat因技术先进.性能稳定,而且免费,因而深受Java 爱好者的喜爱并得到了部分软件开发商的认可,成为目前比较流行的Web 应 ...

  8. [转帖]中信银行信用卡业务数据库实现国产替换,湖北银行新核心系统项目正式验收,阿里云与MongoDB达成战略合作

    中信银行信用卡业务数据库实现国产替换,湖北银行新核心系统项目正式验收,阿里云与MongoDB达成战略合作 http://www.itpub.net/2019/10/31/3942/ 中信银行 gold ...

  9. 对于并发任务,应该使用 Task 替代 BackgroundWorker

    背景 EF + Oracle,并发存储监控记录,使用 BackgroundWorker 时产生错误如下: public void MonitorLogging(DateTime DateStart, ...

  10. #redis 安装命令

    redis 安装命令 cd /usr/local sudo wget http://download.redis.io/releases/redis-4.0.11.tar.gz sudo tar xf ...