mirror of
				https://github.com/byReqz/stocheck.git
				synced 2025-11-03 20:21:30 +00:00 
			
		
		
		
	made smart values optional with adaptec/lsi raid controllers
This commit is contained in:
		
							
								
								
									
										30
									
								
								stocheck.sh
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								stocheck.sh
									
									
									
									
									
								
							@@ -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,22 +149,28 @@ 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 "-------------------------------------------"
 | 
				
			||||||
 | 
					    echo "show all smart values? (y/N)"
 | 
				
			||||||
 | 
					    read yn
 | 
				
			||||||
 | 
					    if [[ $yn == "y" ]] || [[ $yn == "Y" ]] || [[ $yn == "yes" ]];then
 | 
				
			||||||
      scan=$(megacli -pdlist -a0 | grep "Device Id")
 | 
					      scan=$(megacli -pdlist -a0 | grep "Device Id")
 | 
				
			||||||
      p1=$(head -n 1 $scan | cut -c 12-)
 | 
					      p1=$(head -n 1 $scan | cut -c 12-)
 | 
				
			||||||
      pz=$(tail -n 1 $scan | cut -c 12-)
 | 
					      pz=$(tail -n 1 $scan | cut -c 12-)
 | 
				
			||||||
        for x in {$p1..$pz};do
 | 
					        for x in {$p1..$pz};do
 | 
				
			||||||
            if [[ -n $(echo $scan | grep -E "$x") ]];then
 | 
					            if [[ -n $(echo $scan | grep -E "$x") ]];then
 | 
				
			||||||
            echo "------------------- p$x --------------------"
 | 
					            echo "------------------- p$x --------------------"
 | 
				
			||||||
          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:"
 | 
					            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 ""
 | 
				
			||||||
            echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
 | 
					            echo "=== START OF SELF-ASSESSMENT TEST RESULT ==="
 | 
				
			||||||
            smartctl -H -d sat+megaraid,$x /dev/sda | grep -e "SMART overall-health self-assessment test result:"
 | 
					            smartctl -H -d sat+megaraid,$x /dev/sda | grep -e "SMART overall-health self-assessment test result:"
 | 
				
			||||||
@@ -175,6 +184,9 @@ while [ -z "$1" ]; do
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
      exit
 | 
					      exit
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    exit
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
while [ -n "$1" ]; do
 | 
					while [ -n "$1" ]; do
 | 
				
			||||||
      if [[ $1 == "-u" ]] || [[ "$1" == "--update" ]];then
 | 
					      if [[ $1 == "-u" ]] || [[ "$1" == "--update" ]];then
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user