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

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
is there a script that can send to email when the scrub and smart test started and finished and email the result after the scrubbing and smart test? it seems I am not receiving any emails when scrub and smart test run and finish...

thanks!

edit: i create a cron job to start the scrubbing of my pool and after that i received an email that scrubbing is finished.

is there a script that can send an email when the scrubbing starts?
If you use the regular system scheduler for scrubs, and you have your email setup, you should get notification at the start and at the end. I do. Why are you using cron?
I don't know of a way to be notified about SMART tests. I just schedule them to run at a certain time in the morning and know how long they take to run. Then I have the script that mails the SMART report send me the report at a time of day when I know all the tests will have finished. If you are talking the Long SMART test, the time it takes to run is dictated by drive size but usually takes a little more than an hour per terabyte but that also depends on the brand of drive. You just have to look at the test history to compare when you know that you started the test to when the drive reports (in it's log) that the test finished. Short SMART tests usually complete in under 5 minutes regardless of drive size.
 

dyobetem

Cadet
Joined
Aug 6, 2018
Messages
3
If you use the regular system scheduler for scrubs, and you have your email setup, you should get notification at the start and at the end. I do. Why are you using cron?
I don't know of a way to be notified about SMART tests. I just schedule them to run at a certain time in the morning and know how long they take to run. Then I have the script that mails the SMART report send me the report at a time of day when I know all the tests will have finished. If you are talking the Long SMART test, the time it takes to run is dictated by drive size but usually takes a little more than an hour per terabyte but that also depends on the brand of drive. You just have to look at the test history to compare when you know that you started the test to when the drive reports (in it's log) that the test finished. Short SMART tests usually complete in under 5 minutes regardless of drive size.

tried the regular system scheduler for scrubs, i just received the scrub finished email but for the start of scrubbing I didn't receive any email. I just use cron just for testing but still the same results using regular system scheduler for scrub.

do you have any sample email that scrub has been started?

I just schedule them to run at a certain time in the morning and know how long they take to run. Then I have the script that mails the SMART report send me the report at a time of day when I know all the tests will have finished

this is what I am doing right now. just like what OP suggested also.

thank you so much!
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
do you have any sample email that scrub has been started?
It just has a single line, " starting scrub of pool 'pool-name' "

Then I get an email later that says, " scrub of pool 'pool-name' finished "

Nothing fancy about it at all.
 

dyobetem

Cadet
Joined
Aug 6, 2018
Messages
3
It just has a single line, " starting scrub of pool 'pool-name' "

Then I get an email later that says, " scrub of pool 'pool-name' finished "

Nothing fancy about it at all.

I didn't received any email that says " starting scrub of pool 'pool-name' ". Weird. :)
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Some people report wonky emails for some things. I'm not sure anyone ever tracked down the problem.
 

zoomzoom

Guru
Joined
Sep 6, 2015
Messages
677
@dyobetem Configuring a scrub via the Scrub Tasks section will generate an email upon the scrub starting and finishing.
  • New UI: Tasks -> Scrub Tasks
  • Old UI: Storage -> Scrubs

I thought I'd download a newer script from the OP, but trying this with the variables updated doesn't work either!
./ezpool2.sh: 37: Syntax error: word unexpected
The error output is telling you where the error in the script is located (line 37)
 

ITR6

Dabbler
Joined
Jan 8, 2017
Messages
12
Hello!

First of all, thank you for this! I found your script from a suggestion over on the datahoarder subreddit and this is awesome. But I was wondering if I could get a little help.

All of my drives are reporting correctly expect for my Toshiba SAS SSD. I have changed this:

Code:
 if ([ "$(smartctl -i /dev/${drive} | grep "SMART support is: Enabled")" ] && ! [ "$(smartctl -i /dev/${drive} | grep "Solid State Device")" ]); then 

...to...
Code:
 if [ "$(smartctl -i /dev/${drive} | grep "SMART support is: Enabled")" ]; then 


But that single drive is not reporting. I know it will only show a few data points but I would still like it to be there.

Can anyone please assist?

Thank you.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
You're welcome.

IIRC SSDs have a different SMART info output; different enough form the HDD output to not be extracted by the script. You'll need to modify it.
 

LIGISTX

Guru
Joined
Apr 12, 2015
Messages
525
Funny enough, my script ran last night and I am seeing this issue. Any idea what this is? I also get this email error.

f1fdfdd398220b7b9312d0151b8f8aef.png


5209df3f1fa2ce50b52c2f1138af41df.png


9e33feeff5159d2446d6b868c0ab8560.png



Sent from my iPhone using Tapatalk
 

ITR6

Dabbler
Joined
Jan 8, 2017
Messages
12
You're welcome.

IIRC SSDs have a different SMART info output; different enough form the HDD output to not be extracted by the script. You'll need to modify it.
Would you have any idea what I need to do? I'm pretty lost
 

Sjöhaga

Dabbler
Joined
Apr 17, 2016
Messages
41
@ITR6 if you post the output from smartctl -i of your device I'm sure someone will be able to help out,

@LIGISTX I can't see date using --0 or --2 in the zpool_report.sh, has something happened with your script or which are you using?
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Funny enough, my script ran last night and I am seeing this issue. Any idea what this is? I also get this email error.

That's not my script but a fork of it, ask the creator of the fork.

Would you have any idea what I need to do? I'm pretty lost

It's the part with the regex in the awk command (lines 45 to 56 on the pastebin) but if you don't know how to do that you'll have a hard time modifying the script, I recommend to wait for someone who can, I don't have the time myself unfortunately.
 

LIGISTX

Guru
Joined
Apr 12, 2015
Messages
525

ITR6

Dabbler
Joined
Jan 8, 2017
Messages
12
@ITR6 if you post the output from smartctl -i of your device I'm sure someone will be able to help out,
Here is my output from smartctl -i

Code:
=== START OF INFORMATION SECTION ===
Vendor:			   TOSHIBA
Product:			  PX02SMF080
Revision:			 01C6
Compliance:		   SPC-4
User Capacity:		800,166,076,416 bytes [800 GB]
Logical block size:   512 bytes
LU is thin provisioned, LBPRZ=1
Rotation Rate:		Solid State Device
Form Factor:		  2.5 inches
Logical Unit id:	  0x50000394407013a0
Serial number:		---------------
Device type:		  disk
Transport protocol:   SAS (SPL-3)
Local Time is:		Thu Oct 11 12:47:26 2018 CDT
SMART support is:	 Available - device has SMART capability.
SMART support is:	 Enabled
Temperature Warning:  Enabled



It's the part with the regex in the awk command (lines 45 to 56 on the pastebin) but if you don't know how to do that you'll have a hard time modifying the script, I recommend to wait for someone who can, I don't have the time myself unfortunately.

Ok, well thanks for the clue. I'll poke around and see if I learn anything.
 

Sjöhaga

Dabbler
Joined
Apr 17, 2016
Messages
41
@ITR6,

the smart_report.sh is looking for labels like "Model Family" and "Device Model" while your drive outputs none of those labels, you instead have "Vendor" and "Product"

So around line 121 is where you need to start looking for things to change.
 

LIGISTX

Guru
Joined
Apr 12, 2015
Messages
525
@LIGISTX I can't see date using --0 or --2 in the zpool_report.sh, has something happened with your script or which are you using?

I didn't notice this response until just now. As far as I know I am using v1.3... Not sure what could have changed. I suppose I can just copy paste the current script in and see if it fixes it. Maybe something went weird?

Nope, just copied it straight from https://github.com/edgarsuit/FreeNAS-Report and its giving the same error.

I am running under ESXi now.... Could that somehow affect this?

I ran it manually and get this error in shell:

@melp any ideas?

Code:
date: illegal option -- 0
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
date: illegal option -- 2
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
 
Last edited:

LIGISTX

Guru
Joined
Apr 12, 2015
Messages
525
I didn't notice this response until just now. As far as I know I am using v1.3... Not sure what could have changed. I suppose I can just copy paste the current script in and see if it fixes it. Maybe something went weird?

Nope, just copied it straight from https://github.com/edgarsuit/FreeNAS-Report and its giving the same error.

I am running under ESXi now.... Could that somehow affect this?

I ran it manually and get this error in shell:

@melp any ideas?

Code:
date: illegal option -- 0
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
date: illegal option -- 2
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

I realized when I went to ESXi I downloaded the wrong ISO... I was running 11.0U4 not 11.1U4. I am now on 11.1U6 and this issue is gone. Just.... an FYI I suppose to anyone who may be able to look into it/fix what may or may not be broken.
 

SuF1X

Dabbler
Joined
Sep 19, 2018
Messages
35
I didn't notice this response until just now. As far as I know I am using v1.3... Not sure what could have changed. I suppose I can just copy paste the current script in and see if it fixes it. Maybe something went weird?

Nope, just copied it straight from https://github.com/edgarsuit/FreeNAS-Report and its giving the same error.

I am running under ESXi now.... Could that somehow affect this?

I ran it manually and get this error in shell:

@melp any ideas?

Code:
date: illegal option -- 0
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
date: illegal option -- 2
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
			[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]


i also got same isusue. on 11.1 u6.

any idea on fixing?
 

LIGISTX

Guru
Joined
Apr 12, 2015
Messages
525
i also got same isusue. on 11.1 u6.

any idea on fixing?

I figured out my issue, but I don’t actually have a solution.

Turns out when I selected the OS for ESXi I chose 11.0u4 not 11.1u4, so I was seeing the issue on 11.0u4. I have since upgraded to 11.1u6 and no longer have the problem. Wish I could give you more info... but that’s all I got.


Sent from my iPhone using Tapatalk
 

SuF1X

Dabbler
Joined
Sep 19, 2018
Messages
35
I figured out my issue, but I don’t actually have a solution.

Turns out when I selected the OS for ESXi I chose 11.0u4 not 11.1u4, so I was seeing the issue on 11.0u4. I have since upgraded to 11.1u6 and no longer have the problem. Wish I could give you more info... but that’s all I got.


Sent from my iPhone using Tapatalk
darn! im on 11.1u6 but cannot see why its bugging out :(
 
Top