日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

检测raid类型和磁盘坏道脚本

發(fā)布時間:2023/12/10 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 检测raid类型和磁盘坏道脚本 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
#!/bin/sh #腳本功能: #安裝工具M(jìn)egaCli64 #Host Information:主機(jī)名和ip地址 #Raid Information:raid信息和充電狀態(tài) #WARNING Information:MediaErrcount檢測壞塊和哪塊盤 #Disk Information:磁盤信息 #上傳MegaCli壓縮包到opt目錄下 Megdir=/opt/MegaRAID/MegaCli/ cd /opt if [ ! -d $Megdir ];thenunzip MegaCLI.zip cd 8.07.10_MegaCLI_Linux/Linux\ MegaCLI\ 8.07.10/rpm -ivh MegaCli-8.07.10-1.noarch.rpmcp /opt/MegaRAID/MegaCli/MegaCli* /usr/local/sbincp /opt/MegaRAID/MegaCli/MegaCli* /usr/sbinecho "MegaCLI install sucess" elseecho "MegaCLI already install"Hostname=`/bin/hostname`Hostip=`ifconfig | grep broadcast | awk "NR==1" | awk -F" " '{print $2}'`Battery=`MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL|grep "Charger Status"|awk -F: '{print $1" :"$2}'`raid=`MegaCli64 -cfgdsply -aALL|grep "RAID Level"|tail -1|awk -F: '{print $1" :"$2}'`Disknum=`MegaCli64 -cfgdsply -aALL|grep -c "Non Coerced Size"`Onlinedisk=`MegaCli64 -cfgdsply -aALL | grep "Online" | wc -l | sed 's/ //'`Faileddisk=`MegaCli64 -AdpAllInfo -aALL | grep "Failed Disks"|awk -F' ' '{print $4}'`echo ""echo "####################### Host Information #########################"echo "HostName : $Hostname"echo "HostIp : $Hostip"echo ""#raid信息echo "####################### Raid Information ########################"case "$raid"in"RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0") echo "Raid Level :Raid 1";;"RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0") echo "Raid Level :Raid 0";;"RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3") echo "Raid Level :Raid 5";;"RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0") echo "Raid Level :Raid 10";;esac#充電狀態(tài)if [ -z "$Battery" ];thenecho "Battery :Null"elseecho "$Battery"fiecho ""echo "####################### WARNING Information ########################"#預(yù)警的盤以及位置CriticalDisk=`/usr/sbin/MegaCli64 -AdpAllInfo -aALL | grep "Critical Disks" | awk '{print $4}'`if [ $CriticalDisk -eq 0 ];thenecho "Critical Disks is:0"elseCriDisk=`/usr/sbin/MegaCli64 -AdpAllInfo -aALL| grep -E 'Predictive|Slot' | awk '{if(NR%3){printf$0":"}else{print $0}}'|awk -F':' '{if($4!=0){print $2+1}}'`echo "WARNING Critical Disks In:$CriticalDisk"echo "Sector In:$CriDisk"fi#MediaErrcount檢測壞塊和哪塊盤MediaErrcount=`/usr/sbin/MegaCli64 -pdlist -aALL | grep -E "Media Error" |awk -F’:’ -v errcount=0 '{errcount+=$2}END{print errcount}'`OtherErrcount=`/usr/sbin/MegaCli64 -pdlist -aALL | grep -E "Other Error" |awk -F’:’ -v errcount=0 '{errcount+=$2}END{print errcount}'`#壞盤的位置if [[ $MediaErrcount==0||$OtherErrcount==0 ]];thenmDoD=`/usr/sbin/MegaCli64 -pdlist -aALL |grep -E "Media Error|Other Error|Slot" | awk '{if(NR%3){printf$0":"}else{print $0}}' | awk -F':' '{if($4!=0||$6!=0){print $2+1}}'`echo -e "Bad Block In: $mDoD"echo -e "CRITICAL:$MediaErrcount"elseecho "mediaerr:0 and othererr:0"fiecho ""echo "####################### Disk Information ########################"echo "Total Disk Number:$Disknum"echo "Online Disk Number:$Onlinedisk"echo "Failed Disk Number:$Faileddisk"echo "" fi

總結(jié)

以上是生活随笔為你收集整理的检测raid类型和磁盘坏道脚本的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。