LinuxEye - Linux系统教程

LinuxEye - Linux系统教程

当前位置: 主页 > Linux教程 >

Megacli的封装版

时间:2015-02-04 09:46来源:opstool.com 编辑:opstool 点击:
1.用于查看各个磁盘的状态,并高亮的megacli脚本 /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll -NoLog| grep -Ei (enclosure|slot|error|firmware|pre|Foreign|^PD type|^Raw Size) | awk {if($0 ~ /Slot Number/ || $0 ~ /Enclosure/){p
1.用于查看各个磁盘的状态,并高亮的megacli脚本
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll -NoLog| grep -Ei '(enclosure|slot|error|firmware|pre|Foreign|^PD type|^Raw Size)' | awk '{if($0 ~ /Slot Number/ || $0 ~ /Enclosure/){printf("\033[32m%s ",$0);if($0 ~/Slot Number/) printf("\033[0m \n")}else if($0 ~ /bad/||$0 ~/Failed/||$0 ~ /Foreign State: Foreign/){print "\033[31m"$0"\033[0m"}else{print "\033[33m"$0"\033[0m"}}'
输出结果示例:
2.用于查看各个RAID Logical Disk的Megacli脚本
/opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aAll -NoLog|grep -Ei '(^Virtual Disk|^RAID Level|^PD type|^Raw Size|^Enclosure|^Slot|error|firmware)' | awk '{if($0~/^Virtual/||$0~/^RAID/){printf("\033[35m%s\033[0m\n",$0)}else if($0 ~ /^Enclosure/){printf("\033[31m%s: %s\033[0m ",$1,$4)}else if($0 ~ /^Slot/){printf("\033[31m%s\033[0m\n",$0)}else if($0~/^Other/||$0~/Firmware/){printf("\033[33m%s\033[0m\n",$0)}else if($0~/^Raw/){printf("\033[33m%s%s\033[0m\n",$2,$3)}else{printf("\033[33m%s\033[0m ",$0)}}'
对于RAID Level的输出,参考下表,以对应相关的RAID级别
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 RAID 1
RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0 RAID 0
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3 RAID 5
RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0 RAID 10
结果示例:

转载请保留固定链接: https://linuxeye.com/Linux/2181.html

------分隔线----------------------------
标签:Megacli
栏目列表
推荐内容