1
0
mirror of https://github.com/byReqz/stocheck.git synced 2024-11-22 14:41:15 +00:00

made smart values optional with adaptec/lsi raid controllers

This commit is contained in:
Nils 2021-02-10 12:01:51 +00:00 committed by GitHub
parent 1aaaa53ecb
commit 4097cd3c1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ while [ -z "$1" ]; do
scan=$(smartctl --scan) scan=$(smartctl --scan)
if [[ -n $(echo $scan | grep /dev/sd$x) ]];then if [[ -n $(echo $scan | grep /dev/sd$x) ]];then
echo "------------------- /dev/sd$x --------------------" echo "------------------- /dev/sd$x --------------------"
smartctl -i /dev/sd$x | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" smartctl -i /dev/sd$x | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" -e "Multi_Zone_Error_Rate"
echo "" echo ""
echo "=== START OF SELF-ASSESSMENT TEST RESULT ===" echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
smartctl -H /dev/sd$x | grep -e "SMART overall-health self-assessment test result:" smartctl -H /dev/sd$x | grep -e "SMART overall-health self-assessment test result:"
@ -38,7 +38,7 @@ while [ -z "$1" ]; do
scan=$(smartctl --scan) scan=$(smartctl --scan)
if [[ -n $(echo $scan | grep /dev/nvme$x) ]];then if [[ -n $(echo $scan | grep /dev/nvme$x) ]];then
echo "------------------- /dev/nvme$x --------------------" echo "------------------- /dev/nvme$x --------------------"
smartctl -i /dev/nvme$x | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" -e "Model Number:" -e "Total NVM Capacity:" -e "Namespace 1 Utilization" smartctl -i /dev/nvme$x | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" -e "Multi_Zone_Error_Rate" -e "Model Number:" -e "Total NVM Capacity:" -e "Namespace 1 Utilization"
echo "" echo ""
echo "=== START OF SELF-ASSESSMENT TEST RESULT ===" echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
smartctl -H /dev/nvme$x | grep -e "SMART overall-health self-assessment test result:" smartctl -H /dev/nvme$x | grep -e "SMART overall-health self-assessment test result:"
@ -70,7 +70,7 @@ while [ -z "$1" ]; do
for x in {0..20};do for x in {0..20};do
if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then
echo "------------------- p$x --------------------" echo "------------------- p$x --------------------"
smartctl -i -d 3ware,p$x /dev/twe0 | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" smartctl -i -d 3ware,p$x /dev/twe0 | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" -e "Multi_Zone_Error_Rate"
echo "" echo ""
echo "=== START OF SELF-ASSESSMENT TEST RESULT ===" echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
smartctl -H -d 3ware,p$x /dev/twe0 | grep -e "SMART overall-health self-assessment test result:" smartctl -H -d 3ware,p$x /dev/twe0 | grep -e "SMART overall-health self-assessment test result:"
@ -89,7 +89,7 @@ while [ -z "$1" ]; do
for x in {0..20};do for x in {0..20};do
if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then
echo "------------------- p$x --------------------" echo "------------------- p$x --------------------"
smartctl -i -d 3ware,p$x /dev/twa0 | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" smartctl -i -d 3ware,p$x /dev/twa0 | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" -e "Multi_Zone_Error_Rate"
echo "" echo ""
echo "=== START OF SELF-ASSESSMENT TEST RESULT ===" echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
smartctl -H -d 3ware,p$x /dev/twa0 | grep -e "SMART overall-health self-assessment test result:" smartctl -H -d 3ware,p$x /dev/twa0 | grep -e "SMART overall-health self-assessment test result:"
@ -108,7 +108,7 @@ while [ -z "$1" ]; do
for x in {0..20};do for x in {0..20};do
if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then
echo "------------------- p$x --------------------" echo "------------------- p$x --------------------"
smartctl -i -d 3ware,p$x /dev/twl0 | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" smartctl -i -d 3ware,p$x /dev/twl0 | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" -e "Multi_Zone_Error_Rate"
echo "" echo ""
echo "=== START OF SELF-ASSESSMENT TEST RESULT ===" echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
smartctl -H -d 3ware,p$x /dev/twl0 | grep -e "SMART overall-health self-assessment test result:" smartctl -H -d 3ware,p$x /dev/twl0 | grep -e "SMART overall-health self-assessment test result:"
@ -125,17 +125,20 @@ while [ -z "$1" ]; do
fi fi
elif [[ -n $(echo "$raidcheck" | grep -e "Adaptec") ]];then elif [[ -n $(echo "$raidcheck" | grep -e "Adaptec") ]];then
echo "adaptec raid-controller detected" echo "adaptec raid-controller detected"
echo "------------------- adaptec controller --------------------" echo "--------------------- adaptec controller ----------------------"
arcconf GETCONFIG 1 LD arcconf GETCONFIG 1 LD
echo "---------------------------------------------------------------" echo "---------------------------------------------------------------"
echo "=== sata drive check: ===" echo "=== sata drive check: ==="
echo "-------------------------------------------" echo "-------------------------------------------"
arcconf getconfig 1 pd|egrep "Device #|State\>|Reported Location|Reported Channel|S.M.A.R.T. warnings" arcconf getconfig 1 pd|egrep "Device #|State\>|Reported Location|Reported Channel|S.M.A.R.T. warnings"
echo "-------------------------------------------" echo "-------------------------------------------"
echo "show all smart values? (y/N)"
read yn
if [[ $yn == "y" ]] || [[ $yn == "Y" ]] || [[ $yn == "yes" ]];then
for x in {1..20};do for x in {1..20};do
if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then
echo "------------------- sg$x --------------------" echo "------------------- sg$x --------------------"
smartctl -i -d sat /dev/sg$x | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" smartctl -i -d sat /dev/sg$x | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" -e "Multi_Zone_Error_Rate"
echo "" echo ""
echo "=== START OF SELF-ASSESSMENT TEST RESULT ===" echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
smartctl -H -d sat /dev/sg$x | grep -e "SMART overall-health self-assessment test result:" smartctl -H -d sat /dev/sg$x | grep -e "SMART overall-health self-assessment test result:"
@ -146,32 +149,41 @@ while [ -z "$1" ]; do
exit exit
fi fi
done done
else
exit
fi
elif [[ -n $(echo "$raidcheck" | grep -e "LSI") ]];then elif [[ -n $(echo "$raidcheck" | grep -e "LSI") ]];then
echo "lsi raid-controller detected" echo "lsi raid-controller detected"
echo "------------------- LSI controller --------------------" echo "----------------------- LSI controller ------------------------"
megacli -LDInfo -Lall -Aall megacli -LDInfo -Lall -Aall
echo "---------------------------------------------------------------" echo "---------------------------------------------------------------"
echo "=== sata drive check: ===" echo "=== sata drive check: ==="
echo "-------------------------------------------" echo "-------------------------------------------"
megacli -PDList -aAll | egrep "Enclosure Device ID:|Slot Number:|Inquiry Data:|Error Count:|state" megacli -PDList -aAll | egrep "Enclosure Device ID:|Slot Number:|Inquiry Data:|Error Count:|state"
echo "-------------------------------------------" echo "-------------------------------------------"
scan=$(megacli -pdlist -a0 | grep "Device Id") echo "show all smart values? (y/N)"
p1=$(head -n 1 $scan | cut -c 12-) read yn
pz=$(tail -n 1 $scan | cut -c 12-) if [[ $yn == "y" ]] || [[ $yn == "Y" ]] || [[ $yn == "yes" ]];then
for x in {$p1..$pz};do scan=$(megacli -pdlist -a0 | grep "Device Id")
if [[ -n $(echo $scan | grep -E "$x") ]];then p1=$(head -n 1 $scan | cut -c 12-)
echo "------------------- p$x --------------------" pz=$(tail -n 1 $scan | cut -c 12-)
smartctl -i -d sat+megaraid,$x /dev/sda | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" for x in {$p1..$pz};do
echo "" if [[ -n $(echo $scan | grep -E "$x") ]];then
echo "=== START OF SELF-ASSESSMENT TEST RESULT ===" echo "------------------- p$x --------------------"
smartctl -H -d sat+megaraid,$x /dev/sda | grep -e "SMART overall-health self-assessment test result:" smartctl -i -d sat+megaraid,$x /dev/sda | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" -e "Multi_Zone_Error_Rate"
echo "" echo ""
smartctl -A -d sat+megaraid,$x /dev/sda | grep -e "=== START OF READ SMART DATA SECTION ===" -e "SMART overall-health self-assessment test result:" -e "Reallocated_Sector_Ct" -e "Power_On_Hours" -e "Temperature_Celsius" -e "Media_Wearout_Indicator" -e "Power_Cycle_Count" -e "Reported_Uncorrect" echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
echo "-------------------------------------------------" smartctl -H -d sat+megaraid,$x /dev/sda | grep -e "SMART overall-health self-assessment test result:"
else echo ""
exit smartctl -A -d sat+megaraid,$x /dev/sda | grep -e "=== START OF READ SMART DATA SECTION ===" -e "SMART overall-health self-assessment test result:" -e "Reallocated_Sector_Ct" -e "Power_On_Hours" -e "Temperature_Celsius" -e "Media_Wearout_Indicator" -e "Power_Cycle_Count" -e "Reported_Uncorrect"
fi echo "-------------------------------------------------"
done else
exit
fi
done
else
exit
fi
else else
exit exit
fi fi