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

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
Hi, edit the script and in last section (### Send report ###) replace sendmail based command:

Code:
sendmail ${email} < ${logfile}

with following line:

Code:
mail -s "${subject}" < ${logfile} ${email}
Perfect! I'm back up and running, thanks! (v11.3-RELEASE)
 

amorak

Dabbler
Joined
Nov 4, 2015
Messages
29
A week or so ago, my emails stopped formatting properly... Can anyone give me a pointer? below is what the gmail email looks like, and below that is the code I am using.

1584196241839.png




Code:
### 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
    (
 

hervon

Patron
Joined
Apr 23, 2012
Messages
353

Repaired updated scripts are there. Worked for me.
 

mmplpri

Dabbler
Joined
Apr 27, 2017
Messages
22
Code:
status report summary for all drives on server FREENAS ##########

+------+------------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+
|Device|Serial                  |Temp|Power|Start|Spin |ReAlloc|Current|Offline |Seek  |Total     |High  |Command|Last|
|      |Number                  |    |On   |Stop |Retry|Sectors|Pending|Uncorrec|Errors|Seeks     |Fly   |Timeout|Test|
|      |                        |    |Hours|Count|Count|       |Sectors|Sectors |      |          |Writes|Count  |Age |
+------+------------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+
|da0   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da1   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da2   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da3   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da4   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da5   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da6   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da7   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da8   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da9   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da10  |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da11  |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
+------+------------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+

Hi I just updatet script from github and everything works ok bessides first table is just empty where further smart stats are ok
Any solution for this issue I using freenas 11.3 u1 and got lsi 9300 with 10 sas hdd
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Code:
status report summary for all drives on server FREENAS ##########

+------+------------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+
|Device|Serial                  |Temp|Power|Start|Spin |ReAlloc|Current|Offline |Seek  |Total     |High  |Command|Last|
|      |Number                  |    |On   |Stop |Retry|Sectors|Pending|Uncorrec|Errors|Seeks     |Fly   |Timeout|Test|
|      |                        |    |Hours|Count|Count|       |Sectors|Sectors |      |          |Writes|Count  |Age |
+------+------------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+
|da0   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da1   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da2   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da3   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da4   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da5   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da6   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da7   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da8   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da9   |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da10  |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
|da11  |                        |    |     |     |     |       |       |        |   N/A|       N/A|   N/A|    N/A|   0|
+------+------------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+----+

Hi I just updatet script from github and everything works ok bessides first table is just empty where further smart stats are ok
Any solution for this issue I using freenas 11.3 u1 and got lsi 9300 with 10 sas hdd
the smartctl program returns different information for SAS drives than it does for SATA. But I have to admit I'm surprised that you don't get any information at all!
 

mmplpri

Dabbler
Joined
Apr 27, 2017
Messages
22
Any solution to solve this problem? the older script work just fine I just coudnt read anything from email as formating was wrong:(
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Any solution to solve this problem? the older script work just fine I just coudnt read anything from email as formating was wrong:(
There is very little real difference between the old and new versions of the scripts. I think something else is going on that's resulting in you not getting any information.
 

ebartocci

Cadet
Joined
Mar 30, 2020
Messages
4
Thanks Bidule0hm for the scripts.

I have started using "Send config backup to email" script and when I recieve the email from the Freenas server the .tar file is decoded in the body of the email and not attached. I get the below email.

1585678071905.png


Any suggestions on how to have the .tar file attached properly?
I am using the following script "https://pastebin.com/syF2JeAU"
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319

Repaired updated scripts are there. Worked for me.
Awesome! Thanks @Spearfoot ! My formatting had gone wonky for the ZPool Status Report a few months ago and this fixed it.
 

kspare

Guru
Joined
Feb 19, 2015
Messages
508
Is there an updated smart report script for SAS drives?
 

hervon

Patron
Joined
Apr 23, 2012
Messages
353

kspare

Guru
Joined
Feb 19, 2015
Messages
508
i've looked there..so far just sata scripts.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
i've looked there..so far just sata scripts.
Sorry -- the scripts are SATA-centric because I don't own any SAS drives to experiment with.
 

kspare

Guru
Joined
Feb 19, 2015
Messages
508

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
I'd be willing to help test?
No promises, cause I'm busy... but if you could send me (via PM) the output of these commands for as many different SAS drives as possible, I would have enough information to consider making a stab at it.
Code:
smartctl -l selftest /dev/da1
smartctl -A -i -v 7,hex48 /dev/da1
smartctl -i /dev/da1
smartctl -n never -H -A -l error /dev/da1
smartctl -n never -l selftest /dev/da1
And of course, pull requests are always welcome!:)

 

MrTVirus

Dabbler
Joined
Dec 18, 2018
Messages
10
Thanks Bidule0hm for the scripts.

I have started using "Send config backup to email" script and when I recieve the email from the Freenas server the .tar file is decoded in the body of the email and not attached. I get the below email.

View attachment 37033

Any suggestions on how to have the .tar file attached properly?
I am using the following script "https://pastebin.com/syF2JeAU"
I am having this same issue, it seems like it stems from Outlook not supporting UUENCODE and it would have to get re-written (the script) to use MIME encoding instead of UUENCODE. https://stackoverflow.com/questions/54138776/pdf-attachment-appears-as-random-text-in-the-body
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
I am having this same issue, it seems like it stems from Outlook not supporting UUENCODE and it would have to get re-written (the script) to use MIME encoding instead of UUENCODE. https://stackoverflow.com/questions/54138776/pdf-attachment-appears-as-random-text-in-the-body
Have you tried my version? It attaches the encrypted tarball with MIME encoding and works with Outlook and the few other mail clients I've tested.

Forum resource is here:


GitHub repo is here:

 

MrTVirus

Dabbler
Joined
Dec 18, 2018
Messages
10
Have you tried my version? It attaches the encrypted tarball with MIME encoding and works with Outlook and the few other mail clients I've tested.

Forum resource is here:


GitHub repo is here:

Hello. Thank you for that, I am not sure how I missed it. One question though is the configdir , does that need to be used? I really just want the backup to come to my email, but if I do need to specify where to save it, I point it to a dataset correct?
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Hello. Thank you for that, I am not sure how I missed it. One question though is the configdir , does that need to be used? I really just want the backup to come to my email, but if I do need to specify where to save it, I point it to a dataset correct?
Yes, sir, configdir needs to be a directory on your pool.
 

bent98

Contributor
Joined
Jul 21, 2017
Messages
171
I am hoping someone can help me out. I have the original script for SATA drives installed on Freenas 9.x and then I upgrade to 11.2x a while back and ever since then its not working. I am not great with CLI. Is there a new script I need to install? Is there instructions on how to do it?
 
Top