Spearfoot / FreeNAS-scripts

Handy shell scripts for use on FreeNAS servers
326 stars 64 forks source link

Output of scripts show some errors #5

Closed WaaromZoMoeilijk closed 4 years ago

WaaromZoMoeilijk commented 6 years ago

Hey thanks for these scripts, i hope we can fix them for the most current release.

root@freenas:~ # bash get_hdd_temp.sh
=== CPU (8) ===
sysctl: unknown oid 'dev.cpu.0.temperature'
/tmp/1: line 72: [: : integer expression expected
CPU  0:     C
sysctl: unknown oid 'dev.cpu.1.temperature'
/tmp/1: line 72: [: : integer expression expected
CPU  1:     C
sysctl: unknown oid 'dev.cpu.2.temperature'
/tmp/1: line 72: [: : integer expression expected
CPU  2:     C
sysctl: unknown oid 'dev.cpu.3.temperature'
/tmp/1: line 72: [: : integer expression expected
CPU  3:     C
sysctl: unknown oid 'dev.cpu.4.temperature'
/tmp/1: line 72: [: : integer expression expected
CPU  4:     C
sysctl: unknown oid 'dev.cpu.5.temperature'
/tmp/1: line 72: [: : integer expression expected
CPU  5:     C
sysctl: unknown oid 'dev.cpu.6.temperature'
/tmp/1: line 72: [: : integer expression expected
CPU  6:     C
sysctl: unknown oid 'dev.cpu.7.temperature'
/tmp/1: line 72: [: : integer expression expected
CPU  7:     C

=== DRIVES ===
  ada0:   21C [32.0GB] E074080539           SiliconMotion based SSDs (TS32GSSD370S)
  ada1:   18C [32.0GB] E074080508           SiliconMotion based SSDs (TS32GSSD370S)
  ada2:   23C [3.00TB] WD-WCC7K7ZLRND9      Western Digital Red (WDC WD30EFRX-68N32N0)
  ada3:   25C [3.00TB] WD-WCC7K2SPH75X      Western Digital Red (WDC WD30EFRX-68N32N0)
  ada4:   24C [3.00TB] WD-WCC4N1VH31F1      Western Digital Red (WDC WD30EFRX-68EUZN0)
  ada5:   24C [3.00TB] WD-WCC4N5RZNSPE      Western Digital Red (WDC WD30EFRX-68EUZN0)
  ada6:   23C [3.00TB] WD-WCC4N1NHX8A5      Western Digital Red (WDC WD30EFRX-68EUZN0)
  ada7:   25C [3.00TB] WD-WCC4N2AFXK14      Western Digital Red (WDC WD30EFRX-68EUZN0)
   da0:   27C [250GB]  S2R6NX0JB51225X      Samsung based SSDs (Samsung SSD 850 EVO 250GB)
   da1:   16C [32.0GB] E074080587           SiliconMotion based SSDs (TS32GSSD370S)
   da2:   16C [32.0GB] E074080531           SiliconMotion based SSDs (TS32GSSD370S)
   da3:   27C [250GB]  S2R6NX0JB50287W      Samsung based SSDs (Samsung SSD 850 EVO 250GB)
root@freenas:~ # perl get-system-temps.pl
/tmp/2: line 22: use: command not found
/tmp/2: line 23: use: command not found
/tmp/2: line 27: syntax error near unexpected token `('
/tmp/2: line 27: `my $hostname = qx(hostname);'
root@freenas:/tmp # bash save_config_enc.sh
Backup configuration database file: /mnt/HDD/Media/Config/FreeNAS/freenas-FreeNAS-11.1-U1-f7e246b8f-20180131184136.db
sqlite3 status: [ok]
a freenas-FreeNAS-11.1-U1-f7e246b8f-20180131184136.db
tar status: [0]
options are
-in <file>     input file
-out <file>    output file
-pass <arg>    pass phrase source
-e             encrypt
-d             decrypt
-a/-base64     base64 encode/decode, depending on encryption flag
-k             passphrase is the next argument
-kfile         passphrase is the first line of the file argument
-md            the next argument is the md to use to create a key
                 from a passphrase.  One of md2, md5, sha or sha1
-S             salt in hex is the next argument
-K/-iv         key/iv in hex is the next argument
-[pP]          print the iv/key (then exit if -P)
-bufsize <n>   buffer size
-nopad         disable standard block padding
-engine e      use engine e, possibly a hardware device.
Cipher Types
-aes-128-cbc               -aes-128-cbc-hmac-sha1     -aes-128-cbc-hmac-sha256  
-aes-128-ccm               -aes-128-cfb               -aes-128-cfb1             
-aes-128-cfb8              -aes-128-ctr               -aes-128-ecb              
-aes-128-gcm               -aes-128-ofb               -aes-128-xts              
-aes-192-cbc               -aes-192-ccm               -aes-192-cfb              
-aes-192-cfb1              -aes-192-cfb8              -aes-192-ctr              
-aes-192-ecb               -aes-192-gcm               -aes-192-ofb              
-aes-256-cbc               -aes-256-cbc-hmac-sha1     -aes-256-cbc-hmac-sha256  
-aes-256-ccm               -aes-256-cfb               -aes-256-cfb1             
-aes-256-cfb8              -aes-256-ctr               -aes-256-ecb              
-aes-256-gcm               -aes-256-ofb               -aes-256-xts              
-aes128                    -aes192                    -aes256                   
-bf                        -bf-cbc                    -bf-cfb                   
-bf-ecb                    -bf-ofb                    -blowfish                 
-camellia-128-cbc          -camellia-128-cfb          -camellia-128-cfb1        
-camellia-128-cfb8         -camellia-128-ecb          -camellia-128-ofb         
-camellia-192-cbc          -camellia-192-cfb          -camellia-192-cfb1        
-camellia-192-cfb8         -camellia-192-ecb          -camellia-192-ofb         
-camellia-256-cbc          -camellia-256-cfb          -camellia-256-cfb1        
-camellia-256-cfb8         -camellia-256-ecb          -camellia-256-ofb         
-camellia128               -camellia192               -camellia256              
-cast                      -cast-cbc                  -cast5-cbc                
-cast5-cfb                 -cast5-ecb                 -cast5-ofb                
-des                       -des-cbc                   -des-cfb                  
-des-cfb1                  -des-cfb8                  -des-ecb                  
-des-ede                   -des-ede-cbc               -des-ede-cfb              
-des-ede-ofb               -des-ede3                  -des-ede3-cbc             
-des-ede3-cfb              -des-ede3-cfb1             -des-ede3-cfb8            
-des-ede3-ofb              -des-ofb                   -des3                     
-desx                      -desx-cbc                  -id-aes128-CCM            
-id-aes128-GCM             -id-aes128-wrap            -id-aes192-CCM            
-id-aes192-GCM             -id-aes192-wrap            -id-aes256-CCM            
-id-aes256-GCM             -id-aes256-wrap            -id-smime-alg-CMS3DESwrap 
-idea                      -idea-cbc                  -idea-cfb                 
-idea-ecb                  -idea-ofb                  -rc2                      
-rc2-40-cbc                -rc2-64-cbc                -rc2-cbc                  
-rc2-cfb                   -rc2-ecb                   -rc2-ofb                  
-rc4                       -rc4-40                    -rc4-hmac-md5             
-rc5                       -rc5-cbc                   -rc5-cfb                  
-rc5-ecb                   -rc5-ofb                   -seed                     
-seed-cbc                  -seed-cfb                  -seed-ecb                 
-seed-ofb                  
config.sh: line 106: file:/root/config_passphrase: No such file or directory
openssl status: [127]

File is created actually the config_passphrase with perm 0600 Seems to hang at the last output line...

root@freenas:/tmp # bash save_config.sh 
Backup FreeNAS configuration database file: /mnt/HDD/Media/Config/FreeNAS/freenas-FreeNAS-11.1-U1-f7e246b8f-20180131184430.db

Seems to hang here too..

root@freenas:/tmp # bash smart_report.sh 
root@freenas:/tmp # bash -x smart_report.sh
+ email=info@waaromzomoeilijk.nl
++ hostname -s
++ tr '[:lower:]' '[:upper:]'
+ freenashost=FREENAS
+ smartctl=/usr/local/sbin/smartctl
+ logfile=/tmp/smart_report.tmp
+ subject='SMART Status Report for FREENAS'
+ tempWarn=40
+ tempCrit=45
+ sectorsCrit=10
+ testAgeWarn=1
+ warnSymbol='?'
+ critSymbol='!'
+ drives=
+ get_smart_drives drives
++ /usr/local/sbin/smartctl --scan
++ grep dev
++ awk '{print $1}'
++ sed -e 's/\/dev\///'
++ tr '\n' ' '
+ gs_drives='ada0 ada1 ada2 ada3 ada4 ada5 ada6 ada7 da0 da1 da2 da3 '
+ gs_smartdrives=
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/ada0
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/ada1
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/ada2
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/ada3
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/ada4
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3 ada4'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/ada5
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3 ada4 ada5'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/ada6
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3 ada4 ada5 ada6'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/ada7
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3 ada4 ada5 ada6 ada7'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/da0
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3 ada4 ada5 ada6 ada7 da0'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/da1
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3 ada4 ada5 ada6 ada7 da0 da1'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/da2
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3 ada4 ada5 ada6 ada7 da0 da1 da2'
+ for gs_drive in $gs_drives
++ /usr/local/sbin/smartctl -i /dev/da3
++ grep 'SMART support is: Enabled'
++ awk '{print $4}'
+ gs_smart_flag=Enabled
+ '[' Enabled = Enabled ']'
+ gs_smartdrives=' ada0 ada1 ada2 ada3 ada4 ada5 ada6 ada7 da0 da1 da2 da3'
+ eval 'drives=$gs_smartdrives'
++ drives=' ada0 ada1 ada2 ada3 ada4 ada5 ada6 ada7 da0 da1 da2 da3'
+ echo 'To: info@waaromzomoeilijk.nl'
+ echo 'Subject: SMART Status Report for FREENAS'
+ echo 'Content-Type: text/html'
+ echo 'MIME-Version: 1.0'
+ printf '\r\n'
+ echo '<pre style="font-size:14px">'
+ echo '########## SMART status report summary for all drives on server FREENAS ##########'
+ echo ''
+ echo +------+------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+
+ echo '|Device|Serial            |Temp|Power|Start|Spin |ReAlloc|Current|Offline |Seek  |Total     |High  |Command|Last|'
+ echo '|      |Number            |    |On   |Stop |Retry|Sectors|Pending|Uncorrec|Errors|Seeks     |Fly   |Timeout|Test|'
+ echo '|      |                  |    |Hours|Count|Count|       |Sectors|Sectors |      |          |Writes|Count  |Age |'
+ echo +------+------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/ada0
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=0
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/ada0
+ awk -v device=ada0 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=0 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/ada1
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=0
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/ada1
+ awk -v device=ada1 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=0 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/ada2
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=28
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/ada2
+ awk -v device=ada2 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=28 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/ada3
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=23
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/ada3
+ awk -v device=ada3 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=23 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/ada4
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=32
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/ada4
+ awk -v device=ada4 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=32 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/ada5
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=22747
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/ada5
+ awk -v device=ada5 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=22747 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/ada6
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=32
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/ada6
+ awk -v device=ada6 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=32 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/ada7
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=32
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/ada7
+ awk -v device=ada7 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=32 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/da0
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=-
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/da0
+ awk -v device=da0 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=- '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/da1
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=0
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/da1
+ awk -v device=da1 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=0 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/da2
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=0
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/da2
+ awk -v device=da2 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours=0 '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ for drive in $drives
++ /usr/local/sbin/smartctl -l selftest /dev/da3
++ grep '# 1'
++ awk '{print $9}'
+ lastTestHours=
+ /usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/da3
+ awk -v device=da3 -v tempWarn=40 -v tempCrit=45 -v sectorsCrit=10 -v testAgeWarn=1 -v 'warnSymbol=?' -v 'critSymbol=!' -v lastTestHours= '
  /Serial Number:/{serial=$3}
  /190 Airflow_Temperature/{temp=$10}
  /194 Temperature/{temp=$10}
  /Power_On_Hours/{split($10,a,"+");sub(/h/,"",a[1]);onHours=a[1];}
  /Start_Stop_Count/{startStop=$10}
  /Spin_Retry_Count/{spinRetry=$10}
  /Reallocated_Sector/{reAlloc=$10}
  /Current_Pending_Sector/{pending=$10}
  /Offline_Uncorrectable/{offlineUnc=$10}
  /Seek_Error_Rate/{seekErrors=("0x" substr($10,3,4));totalSeeks=("0x" substr($10,7))}
  /High_Fly_Writes/{hiFlyWr=$10}
  /Command_Timeout/{cmdTimeout=$10}
  END {
      testAge=sprintf("%.0f", (onHours - lastTestHours) / 24);
      if (temp > tempCrit || reAlloc > sectorsCrit || pending > sectorsCrit || offlineUnc > sectorsCrit)
          device=device " " critSymbol;
      else if (temp > tempWarn || reAlloc > 0 || pending > 0 || offlineUnc > 0 || testAge > testAgeWarn)
          device=device " " warnSymbol;
      seekErrors=sprintf("%d", seekErrors);
      totalSeeks=sprintf("%d", totalSeeks);
      if (totalSeeks == "0") {
          seekErrors="N/A";
          totalSeeks="N/A";
      }
      if (hiFlyWr == "") hiFlyWr="N/A";
      if (cmdTimeout == "") cmdTimeout="N/A";
      printf "|%-6s|%-18s| %s |%5s|%5s|%5s|%7s|%7s|%8s|%6s|%10s|%6s|%7s|%4s|\n",
      device, serial, temp, onHours, startStop, spinRetry, reAlloc, pending, offlineUnc,
      seekErrors, totalSeeks, hiFlyWr, cmdTimeout, testAge;
      }'
+ echo +------+------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/ada0
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='SiliconMotion based SSDs'
+ '[' -z 'SiliconMotion based SSDs' ']'
++ /usr/local/sbin/smartctl -i /dev/ada0
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=E074080539
+ echo ''
+ echo '########## SMART status report for ada0 drive (SiliconMotion based SSDs: E074080539) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/ada0
+ /usr/local/sbin/smartctl -n never -l selftest /dev/ada0
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/ada1
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='SiliconMotion based SSDs'
+ '[' -z 'SiliconMotion based SSDs' ']'
++ /usr/local/sbin/smartctl -i /dev/ada1
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=E074080508
+ echo ''
+ echo '########## SMART status report for ada1 drive (SiliconMotion based SSDs: E074080508) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/ada1
+ /usr/local/sbin/smartctl -n never -l selftest /dev/ada1
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/ada2
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='Western Digital Red'
+ '[' -z 'Western Digital Red' ']'
++ /usr/local/sbin/smartctl -i /dev/ada2
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=WD-WCC7K7ZLRND9
+ echo ''
+ echo '########## SMART status report for ada2 drive (Western Digital Red: WD-WCC7K7ZLRND9) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/ada2
+ /usr/local/sbin/smartctl -n never -l selftest /dev/ada2
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/ada3
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='Western Digital Red'
+ '[' -z 'Western Digital Red' ']'
++ /usr/local/sbin/smartctl -i /dev/ada3
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=WD-WCC7K2SPH75X
+ echo ''
+ echo '########## SMART status report for ada3 drive (Western Digital Red: WD-WCC7K2SPH75X) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/ada3
+ /usr/local/sbin/smartctl -n never -l selftest /dev/ada3
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/ada4
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='Western Digital Red'
+ '[' -z 'Western Digital Red' ']'
++ /usr/local/sbin/smartctl -i /dev/ada4
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=WD-WCC4N1VH31F1
+ echo ''
+ echo '########## SMART status report for ada4 drive (Western Digital Red: WD-WCC4N1VH31F1) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/ada4
+ /usr/local/sbin/smartctl -n never -l selftest /dev/ada4
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/ada5
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='Western Digital Red'
+ '[' -z 'Western Digital Red' ']'
++ /usr/local/sbin/smartctl -i /dev/ada5
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=WD-WCC4N5RZNSPE
+ echo ''
+ echo '########## SMART status report for ada5 drive (Western Digital Red: WD-WCC4N5RZNSPE) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/ada5
+ /usr/local/sbin/smartctl -n never -l selftest /dev/ada5
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/ada6
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='Western Digital Red'
+ '[' -z 'Western Digital Red' ']'
++ /usr/local/sbin/smartctl -i /dev/ada6
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=WD-WCC4N1NHX8A5
+ echo ''
+ echo '########## SMART status report for ada6 drive (Western Digital Red: WD-WCC4N1NHX8A5) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/ada6
+ /usr/local/sbin/smartctl -n never -l selftest /dev/ada6
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/ada7
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='Western Digital Red'
+ '[' -z 'Western Digital Red' ']'
++ /usr/local/sbin/smartctl -i /dev/ada7
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=WD-WCC4N2AFXK14
+ echo ''
+ echo '########## SMART status report for ada7 drive (Western Digital Red: WD-WCC4N2AFXK14) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/ada7
+ /usr/local/sbin/smartctl -n never -l selftest /dev/ada7
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/da0
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='Samsung based SSDs'
+ '[' -z 'Samsung based SSDs' ']'
++ /usr/local/sbin/smartctl -i /dev/da0
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=S2R6NX0JB51225X
+ echo ''
+ echo '########## SMART status report for da0 drive (Samsung based SSDs: S2R6NX0JB51225X) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/da0
+ /usr/local/sbin/smartctl -n never -l selftest /dev/da0
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/da1
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='SiliconMotion based SSDs'
+ '[' -z 'SiliconMotion based SSDs' ']'
++ /usr/local/sbin/smartctl -i /dev/da1
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=E074080587
+ echo ''
+ echo '########## SMART status report for da1 drive (SiliconMotion based SSDs: E074080587) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/da1
+ /usr/local/sbin/smartctl -n never -l selftest /dev/da1
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/da2
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='SiliconMotion based SSDs'
+ '[' -z 'SiliconMotion based SSDs' ']'
++ /usr/local/sbin/smartctl -i /dev/da2
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=E074080531
+ echo ''
+ echo '########## SMART status report for da2 drive (SiliconMotion based SSDs: E074080531) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/da2
+ /usr/local/sbin/smartctl -n never -l selftest /dev/da2
+ grep '# 1 \|Num'
+ cut -c6-
+ for drive in $drives
++ /usr/local/sbin/smartctl -i /dev/da3
++ grep 'Model Family'
++ awk '{print $3, $4, $5}'
+ brand='Samsung based SSDs'
+ '[' -z 'Samsung based SSDs' ']'
++ /usr/local/sbin/smartctl -i /dev/da3
++ grep 'Serial Number'
++ awk '{print $3}'
+ serial=S2R6NX0JB50287W
+ echo ''
+ echo '########## SMART status report for da3 drive (Samsung based SSDs: S2R6NX0JB50287W) ##########'
+ /usr/local/sbin/smartctl -n never -H -A -l error /dev/da3
+ /usr/local/sbin/smartctl -n never -l selftest /dev/da3
+ grep '# 1 \|Num'
+ cut -c6-
+ sed -i '' -e '/smartctl 6.*/d' /tmp/smart_report.tmp
+ sed -i '' -e '/smartctl 5.*/d' /tmp/smart_report.tmp
+ sed -i '' -e '/smartctl 4.*/d' /tmp/smart_report.tmp
+ sed -i '' -e /Copyright/d /tmp/smart_report.tmp
+ sed -i '' -e '/=== START OF READ/d' /tmp/smart_report.tmp
+ sed -i '' -e '/SMART Attributes Data/d' /tmp/smart_report.tmp
+ sed -i '' -e '/Vendor Specific SMART/d' /tmp/smart_report.tmp
+ sed -i '' -e '/SMART Error Log Version/d' /tmp/smart_report.tmp
+ echo '</pre>'
+ '[' -z info@waaromzomoeilijk.nl ']'
+ sendmail info@waaromzomoeilijk.nl
+ rm /tmp/smart_report.tmp
bash ups_report.sh

I do have a UPS! Before you ask :)

bash zpool_report.sh

The last 3 don't seem to send the actual email, i receive nothing. FreeNAS notifications do work.

svtkobra7 commented 6 years ago

Indeed @Spearfoot rocks!

I think I can answer your first one as I don't have an issue. By chance are you running FreeNAS as a VM in ESXi? I am and have use_ipmi=1 in the script and don't have an issue. When I change use_ipmi=0 I'm able to replicate your issue.

use_ipmi=1 =

=== CPU (2) ===
CPU  1: [46C]
CPU  2: [41C]

use_ipmi=0 =

=== CPU (8) ===
sysctl: unknown oid 'dev.cpu.0.temperature'
get_hdd_temp.sh: line 72: [: : integer expression expected
CPU  0:     C
sysctl: unknown oid 'dev.cpu.1.temperature'
get_hdd_temp.sh: line 72: [: : integer expression expected
CPU  1:     C
sysctl: unknown oid 'dev.cpu.2.temperature'
get_hdd_temp.sh: line 72: [: : integer expression expected
CPU  2:     C
sysctl: unknown oid 'dev.cpu.3.temperature'
get_hdd_temp.sh: line 72: [: : integer expression expected
CPU  3:     C
sysctl: unknown oid 'dev.cpu.4.temperature'
get_hdd_temp.sh: line 72: [: : integer expression expected
CPU  4:     C
sysctl: unknown oid 'dev.cpu.5.temperature'
get_hdd_temp.sh: line 72: [: : integer expression expected
CPU  5:     C
sysctl: unknown oid 'dev.cpu.6.temperature'
get_hdd_temp.sh: line 72: [: : integer expression expected
CPU  6:     C
sysctl: unknown oid 'dev.cpu.7.temperature'
get_hdd_temp.sh: line 72: [: : integer expression expected
CPU  7:     C

If that is the issue you also have to add ipmi relevant data to the script, ipmihost, user, pwfile, path to ipmitool.

WaaromZoMoeilijk commented 6 years ago

Hey man,

I don't have an IPMI capable Mobo. So enabling it isn't an option. I'd like to figure out a way to fix this.

svtkobra7 commented 6 years ago

Are you running FreeNAS as a VM or baremetal? I called out IPMI as with an ESXi install (myself), I believe the only way to easily retrieve cpu temp is via IPMI as ESXi doesn't pass it through.

But honestly, @Spearfoot is the man to ask, I was just attempting to lend a hand if I could. Clearly I = FAIL ... sorry about that.

WaaromZoMoeilijk commented 6 years ago

Sorry forgot to mention I run it on a dedicated server no ESXi server present. We'll wait till he gets around. Thanks for the time though!

Spearfoot commented 4 years ago

Sorry for taking so long to look at this... It seems that FreeNAS (FreeBSD) no longer reports the CPU temperatures via the sysctl command, which the script uses to obtain them. This may be because support for this sysctl OID is no longer supported with newer versions of FreeBSD.

I don't have a hardware-based FreeBSD/FreeNAS installation to debug with -- all of my installations run as ESXi virtual machines.

You might use the suggestions on the following website and see if you can get the appropriate cpu temperature module to load on your system:

https://www.cyberciti.biz/faq/freebsd-determine-processor-cpu-temperature-command/