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

add support for 3ware raid controllers

This commit is contained in:
Nils 2021-01-23 20:35:30 +00:00 committed by GitHub
parent 53a1fc0764
commit 6400e12a80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,31 +8,81 @@ if [[ $(curl -s https://raw.githubusercontent.com/byReqz/stocheck/main/stocheck.
echo "" echo ""
fi fi
while [ ! -n "$1" ]; do while [ ! -n "$1" ]; do
if [[ -n $(ls /sys/block | grep sd) ]];then raidcheck="$(lspci | grep RAID)"
echo "=== sata drive check: ===" if [[ -z "$raidcheck" ]];then
for x in {a..z};do if [[ -n $(ls /sys/block | grep sd) ]];then
scan=$(smartctl --scan) echo "=== sata drive check: ==="
if [[ -n $(echo $scan | grep /dev/sd$x) ]];then for x in {a..z};do
echo "------------------- /dev/sd$x --------------------"; scan=$(smartctl --scan)
smartctl -H -i /dev/sd$x; if [[ -n $(echo $scan | grep /dev/sd$x) ]];then
echo "-------------------------------------------------"; echo "------------------- /dev/sd$x --------------------"
fi smartctl -H -i /dev/sd$x;
done echo "-------------------------------------------------"
if [[ -n $(ls /dev | grep nvme) ]];then fi
echo "=== nvme drive check: ===" done
for x in {0..4};do if [[ -n $(ls /dev | grep nvme) ]];then
scan=$(smartctl --scan) echo "=== nvme drive check: ==="
if [[ -n $(echo $scan | grep /dev/nvme$x) ]];then for x in {0..4};do
echo "------------------- /dev/nvme$x --------------------"; scan=$(smartctl --scan)
smartctl -H -i /dev/nvme$x; if [[ -n $(echo $scan | grep /dev/nvme$x) ]];then
echo "---------------------------------------------------"; echo "------------------- /dev/nvme$x --------------------"
fi smartctl -H -i /dev/nvme$x;
done echo "---------------------------------------------------"
else fi
exit done
fi else
fi exit
done fi
fi
if [[ "$raidcheck" =~ "3ware" ]];then
echo "3ware raid-controller detected"
dreiware=$(tw_cli show | grep c | cut -c -3)
echo "------------------- 3ware controller: $dreiware --------------------"
tw_cli /$dreiware show
echo "---------------------------------------------------------------"
dreiwareversion=$(ls /dev/ | grep t)
if [[ -n $(echo $dreiwareversion | grep twe0) ]];then
echo "6000/7000/8000 series controller detected"
echo "---------------------------------------------------------------"
dreiwaredrives=$(tw_cli /$dreiware show | grep p | cut -c -3)
echo "=== sata drive check: ==="
for x in {0..20};do
if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then
echo "------------------- p$x --------------------"
smartctl -a -d 3ware,p$x /dev/twe0
echo "-------------------------------------------"
fi
done
elif [[ -n $(echo $dreiwareversion | grep twa0) ]];then
echo "9000 series controller detected"
echo "---------------------------------------------------------------"
dreiwaredrives=$(tw_cli /$dreiware show | grep p | cut -c -3)
echo "=== sata drive check: ==="
for x in {0..20};do
if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then
echo "------------------- p$x --------------------"
smartctl -a -d 3ware,p$x /dev/twa0
echo "-------------------------------------------"
fi
done
elif [[ -n $(echo $dreiwareversion | grep twl0) ]];then
echo "9750 series controller detected"
echo "---------------------------------------------------------------"
dreiwaredrives=$(tw_cli /$dreiware show | grep p | cut -c -3)
echo "=== sata drive check: ==="
for x in {0..20};do
if [[ -n $(echo $dreiwaredrives | grep p$x) ]];then
echo "------------------- p$x --------------------"
smartctl -a -d 3ware,p$x /dev/twl0
echo "-------------------------------------------"
fi
done
else
echo "reading smart values for this controller series is not supported"
exit
fi
#adding further controllers here
fi
while [ ! -z "$1" ]; do while [ ! -z "$1" ]; do
if [[ $1 == "-u" ]] || [[ "$1" == "--update" ]];then if [[ $1 == "-u" ]] || [[ "$1" == "--update" ]];then
if [[ $(curl -s https://raw.githubusercontent.com/byReqz/stocheck/main/stocheck.sh | md5sum | cut -c -32) != $(md5sum $0 | cut -c -32) ]];then if [[ $(curl -s https://raw.githubusercontent.com/byReqz/stocheck/main/stocheck.sh | md5sum | cut -c -32) != $(md5sum $0 | cut -c -32) ]];then
@ -55,3 +105,5 @@ while [ ! -z "$1" ]; do
exit exit
fi fi
done done
fi
done