Scripts to report SMART, ZPool and UPS status, HDD/CPU T°, HDD identification and backup the config

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
That's because NVMe, much like SAS, defines SMART data differently. You'd have to adapt the script to read information of interest from NVMe-format SMART output.
 

Green750one

Dabbler
Joined
Mar 16, 2015
Messages
36
I know this is a pretty old thread, but I'm getting an error trying to run these scripts and for the life of me don't see why.
Error is
root@freenas:~ # sh /mnt/Main/Scripts/Runit.sh NB this is the first smart script for sata drives.
: not foundcripts/Runit.sh:
: not foundcripts/Runit.sh:
: not foundcripts/Runit.sh:
: not foundcripts/Runit.sh:
: not foundcripts/Runit.sh:
: not foundcripts/Runit.sh:
/mnt/Main/Scripts/Runit.sh: 39: Syntax error: word unexpected

Line 30 is the "do" command.
ANy ideas?

Thanks in advance.
P
 
Last edited:

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Usually it's because of line wrap; can you post (between codes tags or on pastebin) the output of cat -e /mnt/Main/Scripts/Runit.sh please?
 
Joined
Oct 2, 2014
Messages
925
Anyone got any help for this?
Edit the line "drives" and add nvd0, so it would look something like drives="da0 da1 da2 da3 da4 da5 da6 da7 nvd0"


Sent from my iPhone using Tapatalk
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
You're not going to get SMART from nvd devices. Only the physical nvme device supports SMART, its constituent nvd devices don't.
 

Green750one

Dabbler
Joined
Mar 16, 2015
Messages
36

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
You might want to edit the pastebin to remove your email address...

I can see the line breaks are of the Windows type (\^M$ which means \r\n instead of just $ which is \n) it's maybe the source of the problem.
 

Green750one

Dabbler
Joined
Mar 16, 2015
Messages
36
You might want to edit the pastebin to remove your email address...

I can see the line breaks are of the Windows type (\^M$ which means \r\n instead of just $ which is \n) it's maybe the source of the problem.
Cheers. That worked. I used PSPad and thought it was saving as a Unix sh file. Obviously not!
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Perfect ;)
 

lukyjay

Contributor
Joined
May 13, 2016
Messages
134
None of the scripts are working for me. I get these AWK errors. There's 33 pages to this thread, does anyone know what the problem is without me having to read all 600+ posts?

Code:
root@freenas:~/scripts # ./smart.sh
./smart.sh: +------+---------------+----+-----+-----+-----+-------+-------+--------+------+------+------+-------+----+: not found
./smart.sh: +------+---------------+----+-----+-----+-----+-------+-------+--------+------+------+------+-------+----+: not found
awk: no variable name

./smart.sh: -v: not found
./smart.sh: -v: not found
awk: no variable name

./smart.sh: -v: not found
./smart.sh: -v: not found
awk: no variable name

./smart.sh: -v: not found
./smart.sh: -v: not found
awk: no variable name

./smart.sh: -v: not found
./smart.sh: -v: not found
awk: no variable name

./smart.sh: -v: not found
./smart.sh: -v: not found
awk: no variable name

./smart.sh: -v: not found
./smart.sh: -v: not found
./smart.sh: +------+---------------+----+-----+-----+-----+-------+-------+--------+------+------+------+-------+----+: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3, $4, $5}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3, $4, $5}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3, $4, $5}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3, $4, $5}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3, $4, $5}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3, $4, $5}: not found
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
./smart.sh: {print $3}: not found

 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Can you post (between codes tags or on pastebin; be sure to remove your email address from the script) the output of cat -e ./smart.sh please?
 

lukyjay

Contributor
Joined
May 13, 2016
Messages
134
Thanks for your quick reply. I get these errors with all three (temps, smart and zpool) scripts.

Code:
root@freenas:~/scripts # cat -e ./smart.sh
#!/bin/sh$
 $
### Parameters ###$
logfile="/tmp/smart_report.tmp"$
email="deleted@gmail.com"$
subject="SMART Status Report for FreeNAS"$
drives="ada0 ada1 ada2 ada3 ada4 ada5"$
tempWarn=40$
tempCrit=50$
sectorsCrit=10$
testAgeWarn=1$
warnSymbol="?"$
critSymbol="!"$
 $
### Set email headers ###$
($
  echo "To: ${email}"$
  echo "Subject: ${subject}"$
  echo "Content-Type: text/html"$
  echo "MIME-Version: 1.0"$
  echo -e "\r\n"$
) > "$logfile"$
 $
### Set email body ###$
echo "<pre style=\"font-size:14px\">" >> "$logfile"$
 $
###### summary ######$
($
  echo ""$
  echo "########## SMART status report summary for all drives $
##########"$
  echo ""$
  echo $
"+------+---------------+----+-----+-----+-----+-------+-------+--------+------+------+------+-------+----+"$
  echo "|Device|Serial  |Temp|Power|Start|Spin $
|ReAlloc|Current|Offline |UDMA  |Seek  |High  |Command|Last|"$
  echo "|  |  |  |On  |Stop $
|Retry|Sectors|Pending|Uncorrec|CRC  |Errors|Fly  |Timeout|Test|"$
  echo "|  |  |  |Hours|Count|Count|  $
|Sectors|Sectors |Errors|  |Writes|Count  |Age |"$
  echo $
"+------+---------------+----+-----+-----+-----+-------+-------+--------+------+------+------+-------+----+"$
) >> "$logfile"$
for drive in $drives$
do$
  ($
  smartctl -A -i -v 7,hex48 /dev/"$drive" | \$
  awk -v device="$drive" -v tempWarn="$tempWarn" -v $
tempCrit="$tempCrit" -v sectorsCrit="$sectorsCrit" \$
  -v testAgeWarn="$testAgeWarn" -v warnSymbol="$warnSymbol" -v $
critSymbol="$critSymbol" \$
  -v lastTestHours="$(smartctl -l selftest /dev/"$drive" | grep "# $
1" | awk '{print $9}')" '\$
  /Serial Number:/{serial=$3} \$
  /Temperature_Celsius/{temp=$10} \$
  /Power_On_Hours/{onHours=$10} \$
  /Start_Stop_Count/{startStop=$10} \$
  /Spin_Retry_Count/{spinRetry=$10} \$
  /Reallocated_Sector/{reAlloc=$10} \$
  /Current_Pending_Sector/{pending=$10} \$
  /Offline_Uncorrectable/{offlineUnc=$10} \$
  /UDMA_CRC_Error_Count/{crcErrors=$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|%-15s| %s $
|%5s|%5s|%5s|%7s|%7s|%8s|%6s|%6s|%6s|%7s|%4s|\n",$
  device, serial, temp, onHours, startStop, spinRetry, reAlloc, $
pending, offlineUnc, \$
  crcErrors, seekErrors, hiFlyWr, cmdTimeout, testAge;$
  }'$
  ) >> "$logfile"$
done$
($
  echo $
"+------+---------------+----+-----+-----+-----+-------+-------+--------+------+------+------+-------+----+"$
  echo ""$
  echo ""$
) >> "$logfile"$
 $
###### for each drive ######$
for drive in $drives$
do$
  brand="$(smartctl -i /dev/"$drive" | grep "Model Family" | awk $
'{print $3, $4, $5}')"$
  serial="$(smartctl -i /dev/"$drive" | grep "Serial Number" | awk $
'{print $3}')"$
  ($
  echo ""$
  echo "########## SMART status report for ${drive} drive $
(${brand}: ${serial}) ##########"$
  smartctl -H -A -l error /dev/"$drive"$
  smartctl -l selftest /dev/"$drive" | grep "# 1 \|Num" | cut -c6-$
  echo ""$
  echo ""$
  ) >> "$logfile"$
done$
sed -i '' -e '/smartctl 6.3/d' "$logfile"$
sed -i '' -e '/Copyright/d' "$logfile"$
sed -i '' -e '/=== START OF READ/d' "$logfile"$
sed -i '' -e '/SMART Attributes Data/d' "$logfile"$
sed -i '' -e '/Vendor Specific SMART/d' "$logfile"$
sed -i '' -e '/SMART Error Log Version/d' "$logfile"$
echo "</pre>" >> "$logfile"$
 $
### Send report ###$
sendmail -t < "$logfile"$
rm "$logfile"$
root@freenas:~/scripts #

 

lukyjay

Contributor
Joined
May 13, 2016
Messages
134
It's also worth noting I do get an email...

Here is the email output

Code:
########## SMART status report summary for all drives
##########


|Device|Serial		 |Temp|Power|Start|Spin
|ReAlloc|Current|Offline |UDMA  |Seek  |High  |Command|Last|
|	  |			   |	|On   |Stop
|Retry|Sectors|Pending|Uncorrec|CRC   |Errors|Fly   |Timeout|Test|
|	  |			   |	|Hours|Count|Count|	   
|Sectors|Sectors |Errors|	  |Writes|Count  |Age |





########## SMART status report for ada0 drive
(: ) ##########
smartctl 6.5 2016-05-07 r4318 [FreeBSD 11.0-STABLE amd64] (local build)

SMART overall-health self-assessment test result: PASSED

ID# ATTRIBUTE_NAME		  FLAG	 VALUE WORST THRESH TYPE	  UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate	 0x002f   200   200   051	Pre-fail  Always	   -	   0
  3 Spin_Up_Time			0x0027   185   172   021	Pre-fail  Always	   -	   5708
  4 Start_Stop_Count		0x0032   100   100   000	Old_age   Always	   -	   79
  5 Reallocated_Sector_Ct   0x0033   200   200   140	Pre-fail  Always	   -	   0
  7 Seek_Error_Rate		 0x002e   100   253   000	Old_age   Always	   -	   0
  9 Power_On_Hours		  0x0032   091   091   000	Old_age   Always	   -	   7091
10 Spin_Retry_Count		0x0032   100   253   000	Old_age   Always	   -	   0
11 Calibration_Retry_Count 0x0032   100   253   000	Old_age   Always	   -	   0
12 Power_Cycle_Count	   0x0032   100   100   000	Old_age   Always	   -	   78
192 Power-Off_Retract_Count 0x0032   200   200   000	Old_age   Always	   -	   46
193 Load_Cycle_Count		0x0032   200   200   000	Old_age   Always	   -	   68
194 Temperature_Celsius	 0x0022   116   101   000	Old_age   Always	   -	   34
196 Reallocated_Event_Count 0x0032   200   200   000	Old_age   Always	   -	   0
197 Current_Pending_Sector  0x0032   200   200   000	Old_age   Always	   -	   0
198 Offline_Uncorrectable   0x0030   100   253   000	Old_age   Offline	  -	   0
199 UDMA_CRC_Error_Count	0x0032   200   200   000	Old_age   Always	   -	   0
200 Multi_Zone_Error_Rate   0x0008   200   200   000	Old_age   Offline	  -	   0

No Errors Logged

Test_Description	Status				  Remaining  LifeTime(hours)  LBA_of_first_error
Short offline	   Completed without error	   00%	  7026		 -



########## SMART status report for ada1 drive
(: ) ##########
smartctl 6.5 2016-05-07 r4318 [FreeBSD 11.0-STABLE amd64] (local build)

SMART overall-health self-assessment test result: PASSED

ID# ATTRIBUTE_NAME		  FLAG	 VALUE WORST THRESH TYPE	  UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate	 0x002f   200   200   051	Pre-fail  Always	   -	   0
  3 Spin_Up_Time			0x0027   182   169   021	Pre-fail  Always	   -	   5900
  4 Start_Stop_Count		0x0032   100   100   000	Old_age   Always	   -	   57
  5 Reallocated_Sector_Ct   0x0033   200   200   140	Pre-fail  Always	   -	   0
  7 Seek_Error_Rate		 0x002e   100   253   000	Old_age   Always	   -	   0
  9 Power_On_Hours		  0x0032   091   091   000	Old_age   Always	   -	   7073
10 Spin_Retry_Count		0x0032   100   253   000	Old_age   Always	   -	   0
11 Calibration_Retry_Count 0x0032   100   253   000	Old_age   Always	   -	   0
12 Power_Cycle_Count	   0x0032   100   100   000	Old_age   Always	   -	   56
192 Power-Off_Retract_Count 0x0032   200   200   000	Old_age   Always	   -	   30
193 Load_Cycle_Count		0x0032   200   200   000	Old_age   Always	   -	   130
194 Temperature_Celsius	 0x0022   115   109   000	Old_age   Always	   -	   35
196 Reallocated_Event_Count 0x0032   200   200   000	Old_age   Always	   -	   0
197 Current_Pending_Sector  0x0032   200   200   000	Old_age   Always	   -	   0
198 Offline_Uncorrectable   0x0030   100   253   000	Old_age   Offline	  -	   0
199 UDMA_CRC_Error_Count	0x0032   200   200   000	Old_age   Always	   -	   0
200 Multi_Zone_Error_Rate   0x0008   200   200   000	Old_age   Offline	  -	   0

No Errors Logged

Test_Description	Status				  Remaining  LifeTime(hours)  LBA_of_first_error
Short offline	   Completed without error	   00%	  7009		 -



########## SMART status report for ada2 drive
(: ) ##########
smartctl 6.5 2016-05-07 r4318 [FreeBSD 11.0-STABLE amd64] (local build)

SMART overall-health self-assessment test result: PASSED

ID# ATTRIBUTE_NAME		  FLAG	 VALUE WORST THRESH TYPE	  UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate	 0x002f   200   200   051	Pre-fail  Always	   -	   0
  3 Spin_Up_Time			0x0027   184   181   021	Pre-fail  Always	   -	   5800
  4 Start_Stop_Count		0x0032   100   100   000	Old_age   Always	   -	   27
  5 Reallocated_Sector_Ct   0x0033   200   200   140	Pre-fail  Always	   -	   0
  7 Seek_Error_Rate		 0x002e   100   253   000	Old_age   Always	   -	   0
  9 Power_On_Hours		  0x0032   094   094   000	Old_age   Always	   -	   4916
10 Spin_Retry_Count		0x0032   100   253   000	Old_age   Always	   -	   0
11 Calibration_Retry_Count 0x0032   100   253   000	Old_age   Always	   -	   0
12 Power_Cycle_Count	   0x0032   100   100   000	Old_age   Always	   -	   27
192 Power-Off_Retract_Count 0x0032   200   200   000	Old_age   Always	   -	   13
193 Load_Cycle_Count		0x0032   200   200   000	Old_age   Always	   -	   30
194 Temperature_Celsius	 0x0022   114   112   000	Old_age   Always	   -	   36
196 Reallocated_Event_Count 0x0032   200   200   000	Old_age   Always	   -	   0
197 Current_Pending_Sector  0x0032   200   200   000	Old_age   Always	   -	   0
198 Offline_Uncorrectable   0x0030   100   253   000	Old_age   Offline	  -	   0
199 UDMA_CRC_Error_Count	0x0032   200   200   000	Old_age   Always	   -	   0
200 Multi_Zone_Error_Rate   0x0008   200   200   000	Old_age   Offline	  -	   0

No Errors Logged

Test_Description	Status				  Remaining  LifeTime(hours)  LBA_of_first_error
Short offline	   Completed without error	   00%	  4852		 -



########## SMART status report for ada3 drive
(: ) ##########
smartctl 6.5 2016-05-07 r4318 [FreeBSD 11.0-STABLE amd64] (local build)

SMART overall-health self-assessment test result: PASSED

ID# ATTRIBUTE_NAME		  FLAG	 VALUE WORST THRESH TYPE	  UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate	 0x002f   200   200   051	Pre-fail  Always	   -	   0
  3 Spin_Up_Time			0x0027   179   179   021	Pre-fail  Always	   -	   6033
  4 Start_Stop_Count		0x0032   100   100   000	Old_age   Always	   -	   25
  5 Reallocated_Sector_Ct   0x0033   200   200   140	Pre-fail  Always	   -	   0
  7 Seek_Error_Rate		 0x002e   100   253   000	Old_age   Always	   -	   0
  9 Power_On_Hours		  0x0032   094   094   000	Old_age   Always	   -	   4912
10 Spin_Retry_Count		0x0032   100   253   000	Old_age   Always	   -	   0
11 Calibration_Retry_Count 0x0032   100   253   000	Old_age   Always	   -	   0
12 Power_Cycle_Count	   0x0032   100   100   000	Old_age   Always	   -	   25
192 Power-Off_Retract_Count 0x0032   200   200   000	Old_age   Always	   -	   13
193 Load_Cycle_Count		0x0032   200   200   000	Old_age   Always	   -	   24
194 Temperature_Celsius	 0x0022   114   112   000	Old_age   Always	   -	   36
196 Reallocated_Event_Count 0x0032   200   200   000	Old_age   Always	   -	   0
197 Current_Pending_Sector  0x0032   200   200   000	Old_age   Always	   -	   0
198 Offline_Uncorrectable   0x0030   100   253   000	Old_age   Offline	  -	   0
199 UDMA_CRC_Error_Count	0x0032   200   200   000	Old_age   Always	   -	   0
200 Multi_Zone_Error_Rate   0x0008   200   200   000	Old_age   Offline	  -	   0

No Errors Logged

Test_Description	Status				  Remaining  LifeTime(hours)  LBA_of_first_error
Short offline	   Completed without error	   00%	  4847		 -



########## SMART status report for ada4 drive
(: ) ##########
smartctl 6.5 2016-05-07 r4318 [FreeBSD 11.0-STABLE amd64] (local build)

SMART overall-health self-assessment test result: PASSED

ID# ATTRIBUTE_NAME		  FLAG	 VALUE WORST THRESH TYPE	  UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate	 0x000f   081   069   044	Pre-fail  Always	   -	   119744656
  3 Spin_Up_Time			0x0003   099   099   000	Pre-fail  Always	   -	   0
  4 Start_Stop_Count		0x0032   100   100   020	Old_age   Always	   -	   2
  5 Reallocated_Sector_Ct   0x0033   100   100   010	Pre-fail  Always	   -	   0
  7 Seek_Error_Rate		 0x000f   069   060   045	Pre-fail  Always	   -	   8493236
  9 Power_On_Hours		  0x0032   100   100   000	Old_age   Always	   -	   26 (72 148 0)
10 Spin_Retry_Count		0x0013   100   100   097	Pre-fail  Always	   -	   0
12 Power_Cycle_Count	   0x0032   100   100   020	Old_age   Always	   -	   2
184 End-to-End_Error		0x0032   100   100   099	Old_age   Always	   -	   0
187 Reported_Uncorrect	  0x0032   100   100   000	Old_age   Always	   -	   0
188 Command_Timeout		 0x0032   100   100   000	Old_age   Always	   -	   0
189 High_Fly_Writes		 0x003a   100   100   000	Old_age   Always	   -	   0
190 Airflow_Temperature_Cel 0x0022   065   064   040	Old_age   Always	   -	   35 (Min/Max 24/36)
191 G-Sense_Error_Rate	  0x0032   100   100   000	Old_age   Always	   -	   0
192 Power-Off_Retract_Count 0x0032   100   100   000	Old_age   Always	   -	   1
193 Load_Cycle_Count		0x0032   100   100   000	Old_age   Always	   -	   6
194 Temperature_Celsius	 0x0022   035   040   000	Old_age   Always	   -	   35 (0 24 0 0 0)
197 Current_Pending_Sector  0x0012   100   100   000	Old_age   Always	   -	   0
198 Offline_Uncorrectable   0x0010   100   100   000	Old_age   Offline	  -	   0
199 UDMA_CRC_Error_Count	0x003e   200   200   000	Old_age   Always	   -	   0
240 Head_Flying_Hours	   0x0000   100   253   000	Old_age   Offline	  -	   26 (255 226 0)
241 Total_LBAs_Written	  0x0000   100   253   000	Old_age   Offline	  -	   3658851252
242 Total_LBAs_Read		 0x0000   100   253   000	Old_age   Offline	  -	   3627784956

No Errors Logged




########## SMART status report for ada5 drive
(: ) ##########
smartctl 6.5 2016-05-07 r4318 [FreeBSD 11.0-STABLE amd64] (local build)

SMART overall-health self-assessment test result: PASSED

ID# ATTRIBUTE_NAME		  FLAG	 VALUE WORST THRESH TYPE	  UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate	 0x000f   082   071   044	Pre-fail  Always	   -	   159766280
  3 Spin_Up_Time			0x0003   100   100   000	Pre-fail  Always	   -	   0
  4 Start_Stop_Count		0x0032   100   100   020	Old_age   Always	   -	   1
  5 Reallocated_Sector_Ct   0x0033   100   100   010	Pre-fail  Always	   -	   0
  7 Seek_Error_Rate		 0x000f   066   060   045	Pre-fail  Always	   -	   3855881
  9 Power_On_Hours		  0x0032   100   100   000	Old_age   Always	   -	   10 (71 215 0)
10 Spin_Retry_Count		0x0013   100   100   097	Pre-fail  Always	   -	   0
12 Power_Cycle_Count	   0x0032   100   100   020	Old_age   Always	   -	   1
184 End-to-End_Error		0x0032   100   100   099	Old_age   Always	   -	   0
187 Reported_Uncorrect	  0x0032   100   100   000	Old_age   Always	   -	   0
188 Command_Timeout		 0x0032   100   100   000	Old_age   Always	   -	   0
189 High_Fly_Writes		 0x003a   100   100   000	Old_age   Always	   -	   0
190 Airflow_Temperature_Cel 0x0022   067   067   040	Old_age   Always	   -	   33 (Min/Max 22/33)
191 G-Sense_Error_Rate	  0x0032   100   100   000	Old_age   Always	   -	   0
192 Power-Off_Retract_Count 0x0032   100   100   000	Old_age   Always	   -	   1
193 Load_Cycle_Count		0x0032   100   100   000	Old_age   Always	   -	   3
194 Temperature_Celsius	 0x0022   033   040   000	Old_age   Always	   -	   33 (0 22 0 0 0)
197 Current_Pending_Sector  0x0012   100   100   000	Old_age   Always	   -	   0
198 Offline_Uncorrectable   0x0010   100   100   000	Old_age   Offline	  -	   0
199 UDMA_CRC_Error_Count	0x003e   200   200   000	Old_age   Always	   -	   0
240 Head_Flying_Hours	   0x0000   100   253   000	Old_age   Offline	  -	   10 (51 102 0)
241 Total_LBAs_Written	  0x0000   100   253   000	Old_age   Offline	  -	   3642382300
242 Total_LBAs_Read		 0x0000   100   253   000	Old_age   Offline	  -	   534229

No Errors Logged

 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
You have a lot of newline chars where you shouldn't. You need to copy the script from the original pastebin I made and be careful that the window where you paste it is large enough (do not use the web UI CLI for example, use PuTTY or SSH) so the lines don't wrap like they've done here.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
You have a lot of newline chars where you shouldn't.
That's the problem exactly. If using the nano editor, the -w flag will avoid the line wrapping: nano -w filename.sh.
 

lukyjay

Contributor
Joined
May 13, 2016
Messages
134
Ah, I'm using SSH from Solus but forgot -w :) Thanks!
 

Amsoil_Jim

Contributor
Joined
Feb 22, 2016
Messages
175
I recently update to version 11.1 and this morning my cronjob ran and I received this email

Code:
Subject:Cron <root@FreeNAS> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/Media/James/scripts/report3.sh > /dev/null 

Failed conversion of ``17-on-Fri_Nov'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
Failed conversion of ``17-on-Fri_Nov'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
Failed conversion of ``11-on-Mon_Dec'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]


Also the resulting email from the script running showed this
Screen Shot 2017-12-16 at 10.27.00 AM.png
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
I recently update to version 11.1 and this morning my cronjob ran and I received this email

Code:
Subject:Cron <root@FreeNAS> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/Media/James/scripts/report3.sh > /dev/null

Failed conversion of ``17-on-Fri_Nov'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
Failed conversion of ``17-on-Fri_Nov'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
Failed conversion of ``11-on-Mon_Dec'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]


Also the resulting email from the script running showed this
View attachment 21869
I kind of hate to be a "Me Too", but I have this issue also and I can only guess that it is an incompatibility between the old OS and the new OS.
I will look at it, but it might be a good thing if others put eyes on it also.

Not sure why it is different, but the output from the cron email I got was different:
Code:
Failed conversion of ``9-on-Sat_Dec'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
Failed conversion of ``6-on-Wed_Dec'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
Failed conversion of ``11-on-Mon_Dec'' using format ``%Y-%b-%e_%H:%M:%S''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I can only guess that it is an incompatibility between the old OS and the new OS.
It's a difference in format in the output of zpool status. Also reported and discussed on the thread about the github page for the FreeNAS scripts.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
It's a difference in format in the output of zpool status. Also reported and discussed on the thread about the github page for the FreeNAS scripts.
Thanks, I didn't look in the discussion there.

These are the two lines of the script that need to be changed:
Code:
#	scrubErrors="$(zpool status "$pool" | grep "scan" | awk '{print $8}')"
	scrubErrors="$(zpool status "$pool" | grep "scan" | awk '{print $10}')"

#	scrubDate="$(zpool status "$pool" | grep "scan" | awk '{print $15"-"$12"-"$13"_"$14}')"
	scrubDate="$(zpool status "$pool" | grep "scan" | awk '{print $17"-"$14"-"$15"_"$16}')"

 
Last edited:
Top