【Zabbix】Megacli学习和脚本

Linux版

#查看RAID的级别
#egrep 再文件内查找指定的字符串, 正则匹配raid level的字段 space代表空格,和tab。#sed -n仅显示script处理后的结果。#正则匹配字段
RAID_Level=$(sudo /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -L$1 -aALL -NoLog |egrep -i "^\<RAID Level\>[[:space:]]*:" |sed -n 1p |sed "s/^RAID Level[[:space:]]*:[[:space:]]*//ig")

Span_Depth=$(sudo /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -L$1 -aALL -NoLog |egrep -i "^\<Span Depth\>[[:space:]]*:" |sed -n 1p |sed "s/^Span Depth[[:space:]]*:[[:space:]]*//ig")
#几块硬盘
Drives=$(sudo /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -L$1 -aALL -NoLog |egrep -i "^\<Number Of Drives\>.*[[:space:]]*:" |sed -n 1p |sed "s/^Number Of Drives.*[[:space:]]*:[[:space:]]*//ig")

Hot_Spares=$(sudo /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -L$1 -aALL -NoLog |egrep -i "^\<Number of Dedicated Hot Spares\>.*[[:space:]]*:" |sed -n 1p |sed "s/^Number of Dedicate

猜你喜欢

转载自blog.csdn.net/lengyer/article/details/119927690
今日推荐