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

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
As the system scrub only takes a couple of minutes, why don't you just set it to 14 days and forget about it?

Mine is set to 5.
 

Xyrgh

Explorer
Joined
Apr 11, 2016
Messages
69
As the system scrub only takes a couple of minutes, why don't you just set it to 14 days and forget about it?

Mine is set to 5.

I'm not overly concerned about the period of time, but when the actual test occurred. FreeNAS seems to be set at running the scrub at 3:45am, I wanted to change that time.
 
Joined
Jan 4, 2014
Messages
1,644
Brilliant! A big Thank You. Just one question. I note from your schedule that your boot scrub is scheduled for day 1 and 16. How have you managed that? I understand you can set an automatic scrub interval (default 35 days) , but I didn't think that specifying specific days was possible.
Thank you all for responding to my query. If there's one thing I've come to appreciate here, it's that there is always something new to learn and there is a wealth of knowledge in the collective.
 
Last edited:

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
We are the Borg. You will be assimilated. Resistance is futile.

Your biological and technological distinctiveness will be added to our own.
 
Joined
Jan 4, 2014
Messages
1,644
Let me know if anyone else has suggestions/requests.

SMART section of the reports for 4 FreeNAS servers are included below. Systems A & B use Seagate Ironwolf NAS drives; systems C & D use Western Digital Reds. Notwithstanding that system D has drives with bad sectors (which I'm looking into - note the Power-On Hours for those drives is close to 5 years), I'd like to draw your attention to the Seek Error Health column for all systems. Warnings are not flagged for systems C & D with the WD Reds. Warnings are flagged for systems A & B with the Seagate Ironwolf drives, but I think these are false positives. The Seagate drives must be using the register in a different way. I've tried to find out more, but drive manufacturers seem reluctant about releasing any SMART proprietary reporting details. I guess what I'm alluding to is the logic you're using to warn of Seek Error Health may work for WD drives, but may not be applicable for Seagate (and other manufacturer?) drives. Thoughts?
reports.jpg
 
Last edited:
Joined
Jan 4, 2014
Messages
1,644
Let me know if anyone else has suggestions/requests.
Having upgraded a FreeNAS server from 9.10.2-U5 to 11.0 on the w/e, I noticed a slight change in the formatting of the report. Check out the Temperature column in the image below. I confirmed the change by running the report on a second server on 9.10.2-U5 and then re-running the report again after upgrading the second server to 11.0. Something in the latest version of FreeNAS has broken (slightly) the formatting of the report.

Sketch - post upgrade .png
 
Last edited:

Amsoil_Jim

Contributor
Joined
Feb 22, 2016
Messages
175
I'm wondering if someone can give me a hint to why my smart report/backup cron job is not working.
I recently transferred my drives into a new system and imported the volume into a fresh install of freenas 11. this script was working just fine on the previous machine.
when I test the script via ssh it works just fine, I get one email with a report and a second with a confer backup.
but when I try to test the cron job using the "Run Now" button created the tmp file for the report email but doesn't send it.
the location of the script is "/mnt/Media/James/scripts/report.sh" and that is what is in the Command section of the cron job
any suggestions?
 
Joined
Jan 4, 2014
Messages
1,644
I'm wondering if someone can give me a hint to why my smart report/backup cron job is not working.
I recently transferred my drives into a new system and imported the volume into a fresh install of freenas 11. this script was working just fine on the previous machine.
when I test the script via ssh it works just fine, I get one email with a report and a second with a confer backup.
but when I try to test the cron job using the "Run Now" button created the tmp file for the report email but doesn't send it.
the location of the script is "/mnt/Media/James/scripts/report.sh" and that is what is in the Command section of the cron job
any suggestions?
Are you able to send a test email from the GUI? Are you getting other system generated reports via email?

Sent from my Nexus 6P using Tapatalk
 
Joined
Jan 4, 2014
Messages
1,644
Having upgraded a FreeNAS server from 9.10.2-U5 to 11.0 on the w/e, I noticed a slight change in the formatting of the report. Check out the Temperature column in the image below. I confirmed the change by running the report on a second server runnning 9.10.2-U5 and then re-running the report again after upgrading the second server to 11.0. Something in the latest version of FreeNAS has broken (slightly) the formatting of the report.

View attachment 18984
Curious...Under FreeNAS 11.0, if I run the report from ssh, there are no formatting errors. However, when submitted as a cron job, the formatting error appears. This behaviour did not exist in FreeNAS 9.10.2-U5. Wondering if 11.0 has introduced a bug that is highlighted by the scheduler?
 
Last edited:

Amsoil_Jim

Contributor
Joined
Feb 22, 2016
Messages
175
Are you able to send a test email from the GUI? Are you getting other system generated reports via email?

Sent from my Nexus 6P using Tapatalk
Yes I receive normal system emails and sending the test email works.
 
Joined
Jan 4, 2014
Messages
1,644

Amsoil_Jim

Contributor
Joined
Feb 22, 2016
Messages
175
var/log/mailog may provide additional clues. Hint from an old bug report Mail from cron not working
this is what was in the var/log/maillog
Code:
root@FreeNAS:/var/log # more maillog
Jun 19 00:00:00 FreeNAS newsyslog[48945]: logfile turned over
Jun 19 03:01:02 FreeNAS /find_alias_for_smtplib.py[56491]: sending mail to rootTo: root
Subject: FreeNAS.local daily security run output

No /var/log/mount.today

No /var/log/dmesg.today

-- End of security output --

Jun 19 03:01:06 FreeNAS /find_alias_for_smtplib.py[56491]: sending mail to red.*********@gmail.comContent-Type: text/plain; charset="utf-8"

MIME-Version: 1.0

Content-Transfer-Encoding: base64

Subject: FreeNAS.local daily security run outp

Jun 19 03:01:07 FreeNAS /find_alias_for_smtplib.py[56653]: sending mail to rootTo: root

Subject: FreeNAS.local daily run output



Local system status:

 3:01AM  up 11:21, 0 users, load averages: 1.59, 1.05, 0.87


-- End 

Jun 19 03:01:07 FreeNAS /find_alias_for_smtplib.py[56653]: sending mail to red.*********@gmail.comContent-Type: text/plain; charset="utf-8"

MIME-Version: 1.0

Content-Transfer-Encoding: base64

Subject: FreeNAS.local daily run output

From: 

--More--(END)
 

Amsoil_Jim

Contributor
Joined
Feb 22, 2016
Messages
175
when i click run now on the cron job this shows up as soon as I click it.
ezlgy1.png
 
Joined
Jan 4, 2014
Messages
1,644
when i click run now on the cron job this shows up as soon as I click it.
ezlgy1.png
Seems you have bigger issues than just the report. I note you worked from a fresh install of 11.0. I took an upgrade path from 9.10.2-U5 to 11.0. Not sure I have anything more to add at this stage. Unless someone with more experience has something to add, I'd be considering configuring a fresh install of 11.0. Alternatively, install and configure 9.10.2-U5, test that the report works and then upgrade to 11.0.
 

Amsoil_Jim

Contributor
Joined
Feb 22, 2016
Messages
175
Just an update... the script works and the cron job ran as scheduled and it worked. So the only issue is that when clicking the "Run Now" button to run the Cron Job does not work.
 
Last edited:

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
@melp Thank you for your script. It looks great! I have a request. What would be the code to add another column listing the Power-On Hours
Code:
Power_On_Hours/{onHours=$10} \
as yy mm dd? Is that possible?
 

melp

Explorer
Joined
Apr 4, 2014
Messages
55
@melp Thank you for your script. It looks great! I have a request. What would be the code to add another column listing the Power-On Hours
Code:
Power_On_Hours/{onHours=$10} \
as yy mm dd? Is that possible?
Oooo, I like that, should be pretty easy to do. I'll work on it later today and update the file on github :)
 

ArgaWoW

Patron
Joined
Jul 4, 2015
Messages
444
Oooo, I like that, should be pretty easy to do. I'll work on it later today and update the file on github :)
I use a spindown script for my hdd. Will it also be possible to add the state for each disc spinning/not spinning ?

I tried to add this by my self without success:/
 

LaserAllan

Dabbler
Joined
Mar 25, 2017
Messages
34
e39574a8-908a-42b2-bf17-179842641eb6
Updated version of the report here: https://github.com/edgarsuit/FreeNAS-Report

I added logic to auto-detect drives (omitting SSDs) and pools. I also played around with the columns a bit (added a SMART summary column and last test type column). Let me know if anyone else has suggestions/requests.

xPcW20d.png


Not sure if i am doing something obviously wrong, but I am getting "command not found" and permission denied when i try to run this script, even as root.
 
Top