Resource icon

TrueNAS-Report 1.8

dak180

Patron
Joined
Nov 22, 2017
Messages
308
dak180 submitted a new resource:

FreeNAS-Report - SMART & ZPool Status Report for FreeNAS/TrueNAS

ZPool, SMART, and UPS Status Report with TrueNAS Config Backup​

Original Script By: joeschmuck
Modified By: bidelu0hm, melp, fohlsso2, onlinepcwizard, ninpucho, isentropik, rotx, dak180
Last Edited By: dak180

Current Version: v1.8

Preview of the output here: https://i.imgur.com/jKwraw4.png When a resilver is in progress: https://i.imgur.com/CUNUZ7r.png After the resilver is done: https://i.imgur.com/I43MLLf.png When a scrub is in...

Read more about this resource...
 

dauntless101

Cadet
Joined
Mar 21, 2017
Messages
7
Thanks for the script! I'm getting this error when running on TrueNAS-SCALE-23.10.1

Code:
sysctl is missing, please install
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308

dak180

Patron
Joined
Nov 22, 2017
Messages
308
Where is the update? Still seeing this as the posted version:
I only update that for a major version; the download button will always get you the latest version and you can checkout development on github.
 

lukazy88

Dabbler
Joined
Jul 7, 2021
Messages
13
Hi,
I did setup everything as you stated but the E-Mail is not sent out.
Sending Mail is not the issue because I get mails with "Please edit the config file for your setup" just fine.

In the generated log file I can see the report got created it is just not getting send out for some reason.
Any idea why?
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308
@lukazy88 can you post your config file (in code tags) and also the output from when you run the script from the command line (including your invocation).
 

lukazy88

Dabbler
Joined
Jul 7, 2021
Messages
13
cronjob command is:
/User-Scripts/Report.sh -c /User-Scripts/report.cfg

/User-Scripts/report.cfg:
# Set this to 0 to enable
defaultFile="0"

###### User-definable Parameters
### Email Address
email="mymail@domain.com"

### Global table colors
okColor="#c9ffcc" # Hex code for color to use in SMART Status column if drives pass (default is light green, #c9ffcc)
warnColor="#ffd6d6" # Hex code for WARN color (default is light red, #ffd6d6)
critColor="#ff0000" # Hex code for CRITICAL color (default is bright red, #ff0000)
altColor="#f4f4f4" # Table background alternates row colors between white and this color (default is light gray, #f4f4f4)

### zpool status summary table settings
usedWarn="90" # Pool used percentage for CRITICAL color to be used
scrubAgeWarn="30" # Maximum age (in days) of last pool scrub before CRITICAL color will be used

### SMART status summary table settings
includeSSD="true" # Change to "true" to include SSDs in SMART status summary table; "false" to disable
includeSAS="false" # Change to "true" to include SAS drives in SMART status summary table; "false" to disable
lifeRemainWarn="75" # Life remaining in the SSD at which WARNING color will be used
lifeRemainCrit="50" # Life remaining in the SSD at which CRITICAL color will be used
totalBWWarn="100" # Total bytes written (in TB) to the SSD at which WARNING color will be used
totalBWCrit="200" # Total bytes written (in TB) to the SSD at which CRITICAL color will be used
tempWarn="35" # Drive temp (in C) at which WARNING color will be used
tempCrit="40" # Drive temp (in C) at which CRITICAL color will be used
ssdTempWarn="40" # SSD drive temp (in C) at which WARNING color will be used
ssdTempCrit="45" # SSD drive temp (in C) at which CRITICAL color will be used
sectorsCrit="10" # Number of sectors per drive with errors before CRITICAL color will be used
testAgeWarn="5" # Maximum age (in days) of last SMART test before CRITICAL color will be used
powerTimeFormat="ymdh" # Format for power-on hours string, valid options are "ymdh", "ymd", "ym", or "y" (year month day hour)

### TrueNAS config backup settings
configBackup="false" # Change to "false" to skip config backup (which renders next two options meaningless); "true" to keep config backups enabl>
emailBackup="false" # Change to "true" to email TrueNAS config backup
saveBackup="true" # Change to "false" to delete TrueNAS config backup after mail is sent; "true" to keep it in dir below
backupLocation="/User-Scripts" # Directory in which to save TrueNAS config backups

### UPS status summary settings
reportUPS="false" # Change to "false" to skip reporting the status of the UPS

### General script settings
logfileLocation="/User-Scripts" # Directory in which to save TrueNAS log file. Can be set to /tmp.
logfileName="logfilename" # Log file name
saveLogfile="true" # Change to "false" to delete the log file after creation

##### Drive Overrides
# In the form: declare -A _<serial>
# And then for each override: _<serial>[<value>]="<adjustment>"
# Replace any non ascii alphanumeric characters with _ in the serial.

when run from comandline (no output):
root@FreeNAS-Buero:/User-Scripts # /User-Scripts/Report.sh -c /User-Scripts/report.cfg
root@FreeNAS-Buero:/User-Scripts #
Currently running Core Version: TrueNAS-13.0-U4
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308
@lukazy88 I assume that the email address in the config file is your actual email address?
 

lukazy88

Dabbler
Joined
Jul 7, 2021
Messages
13
@lukazy88 I assume that the email address in the config file is your actual email address?
yes, mails like the one saying:
Please edit the config file for your setup
get sent ount fine. But not to the E-Mail thats in the config file but rather to the email in general TrueNAS settings if that help.
Also log fine with E-mail content is also generated just fine.
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308
yes, mails like the one saying:

Please edit the config file for your setup
Those are sent by the system not the script which is why I asked if the email set in the config file is correct; it does not use the system settings for the email address to send to.
 

lukazy88

Dabbler
Joined
Jul 7, 2021
Messages
13
looked at the script a little closer and ran the line that send the mail seperatly:
root@FreeNAS-Buero:/User-Scripts # sendmail -ti < 20240208095848_logfilename.tmp
root@FreeNAS-Buero:/User-Scripts #
no response and no mail in my inbox (spam/virus folders are empty as well).

tried this and successfully got a mail:
echo "Subject: sendmail test" | sendmail -v mymail@domain.com
not an expert on shell scripting but seems like the sendmail command is maybe not correct?
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308
It does use the System / Email options in the GUI; how is that setup?
 

lukazy88

Dabbler
Joined
Jul 7, 2021
Messages
13
Setup is pretty standard and sending test mails works fine (sry for it being in german xD):

1707424531495.png


I would think the content of the log file does not correctly get put into the sendmail command (if that makes sense to you)
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308
Try changing logfileLocation="/User-Scripts" to logfileLocation="/tmp"; as a general rule your user scripts should be in a dataset (somewhere in /mnt/{pool name}/{dataset}) not at the root level, nothing on the boot pool should be expected to survive updates.
 

lukazy88

Dabbler
Joined
Jul 7, 2021
Messages
13
ok I moved it to a storage pool & changed the logfile location back. I have that script on multiple machines always in this location and it was fine for multiple updates dating back to freenas 9 I think.

Running from commandline (no response but still no email):
root@FreeNAS-Buero:/User-Scripts # /mnt/Backup/Backup-Home/Report.sh -c /mnt/Backup/Backup-Home/report.cfg
root@FreeNAS-Buero:/User-Scripts #
Running cronjob gives no error, Mails like "Please edit the config file for your setup" get sent out fine
Basicly everything stays exactly the same no matter the location change.
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308
Try running the sendmail command as sendmail -v -t -oi < 20240208095848_logfilename.tmp and see if that changes anything.
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308
@lukazy88 can you attach the *_logfilename.tmp file to a PM so I can look at it in more detail?
 
Top