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

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
@Bidule0hm , you do know email clients don't necessarily render HTML properly, right? This is an ongoing source of frustration for anyone trying to deliver mobile-friendly bulk email.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Yes, but here everything tells me it should work :)
 

ChiknNutz

Patron
Joined
Nov 6, 2015
Messages
217
First screenshot is from the Gmail app. Turning the phone sideways in this app makes no difference.
image.png

This second one is after forwarding the email to another email address to the native iPhone email app and then turning the phone sideways.
image.png
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Ok, let's bring the big guns; replace this:
Code:
echo "<div style=\"white-space: nowrap; overflow-x: scroll;\"><pre style=\"font-size:14px\">" >> "$logfile"


with this:
Code:
echo "<div style=\"white-space:nowrap !important;overflow-x:scroll !important;width:100% !important; clear:both !important;\">" >> "$logfile"
echo "<pre style=\"font-size:14px\">" >> "$logfile"


I still have one other (original...) idea if this doesn't work :)
 

ChiknNutz

Patron
Joined
Nov 6, 2015
Messages
217
Same results, no identifiable change. I messed with the font size and width percent, but neither made any appreciable difference.

One small request. I don't know about anybody else, but I think it would be handy to see the SMART (i.e. PASSED, FAILED, etc.) assessment right at the beginning of the email...perhaps added to the first table. Although that does make that table wider.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Ok, it's time for a bit of HTML hacking (if that's even a thing... :D), if you can't fix the problem just go around it :p

Replace this:
Code:
echo "<div style=\"white-space:nowrap !important;overflow-x:scroll !important;width:100% !important; clear:both !important;\">" >> "$logfile"
echo "<pre style=\"font-size:14px\">" >> "$logfile"


with this:
Code:
echo "<marquee direction=\"left\" scrolldelay=\"60\" scrollamount=\"2\"><pre style=\"font-size:14px\">" >> "$logfile"


And this:
Code:
echo "</pre></div>" >> "$logfile"


with this:
Code:
echo "</pre></marquee>" >> "$logfile"


An example of the result you should have: http://jsfiddle.net/Biduleohm/6572pezo/embedded/result/

If you want to make it slower increase the scrolldelay. If you want to make it quicker increase the scrollamount (you can't decrease the scrolldelay to less than 60 and the lower the scrollamount the smoother the scroll is).

If it doesn't work I'm running out of ideas...

Yes, I can add that to the summary, but I'm not sure it'll be useful because the warning and critical symbols I add after the drive label are much more sensitive to drive problems than the passed/failed test (who just check if the drive has failed the last test, but the drive can be in a pretty bad state and still pass the test...). If anyone else find that useful please tell me :)
 
Last edited:

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Sometimes you need to be creative... :D
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
@Bidule0hm How can I get a very quick header at the top of the SMART report to look like this:

ada0 SMART overall-health self-assessment test result: PASSED
No Errors Logged

ada1 SMART overall-health self-assessment test result: PASSED
No Errors Logged

etc...
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
First screenshot is from the Gmail app. Turning the phone sideways in this app makes no difference.
View attachment 9533

This second one is after forwarding the email to another email address to the native iPhone email app and then turning the phone sideways.
View attachment 9534
I changed the font size to 1em (100% width of the frame) and it renders perfectly in my browser and looks just as good in landscape on my phone. In the browser, the text size looks like maybe 7pt font. You can play around with it to suit your monitor size, e.g. 1.5em
 
Last edited:

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Use grep to select these lines. Seems like now there's two people who want the test result in the summary... well, I'll add it then, when I have the time :)

Yes, because any decent mail client will see the <pre> tag and will not circumvent it. But it seems the mail client used by @ChiknNutz is very agressive and doesn't render the mail like it should do. I hate smartphones and I hate even more when I see (very) bad implementations like that, some people should die for doing this kind of things... :mad:

Hopefully the marquee trick will work.
 

ChiknNutz

Patron
Joined
Nov 6, 2015
Messages
217
I don't have to use the Gmail client, it's just the email address I decided to use for this. Like many folks, I have several email addresses to choose from and could use the built in mail client which seems a bit more forgiving of the formatting.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710

ChiknNutz

Patron
Joined
Nov 6, 2015
Messages
217
Yes I have. I went back and tried each flavor and sent the email to a non-Gmail account too, all with similar results...none of which have done the trick yet :-(
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Well, I'm sorry but I don't have any other idea besides trying others clients.
 

ChiknNutz

Patron
Joined
Nov 6, 2015
Messages
217
I changed the font size to 1em (100% width of the frame) and it renders perfectly in my browser and looks just as good in landscape on my phone. In the browser, the text size looks like maybe 7pt font. You can play around with it to suit your monitor size, e.g. 1.5em

Which script "version" did you try this with...the original? Also, do you literally replace "14px" with "1em" in the script?
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
Which script "version" did you try this with...the original? Also, do you literally replace "14px" with "1em" in the script?
Any of them listed on the first post. Yes, literal replacement.
 

shnurov

Explorer
Joined
Jul 22, 2015
Messages
74
I'm having a hard time with the cron jobs paths.
I have the scripts created in :

root/scripts/cpu_hdd_temp.sh
Now that's what I wrote in the cron job in the path is :
/root/scripts/cpu_hdd_temp.sh

The e-mail I get is:

Code:
Cron <root@freenas> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /root/scrips/cpu_hdd_temp.sh > /dev/null

with the body
Code:
/root/scrips/cpu_hdd_temp.sh: not found


Any ideas where I messed up? :(
 

ethereal

Guru
Joined
Sep 10, 2012
Messages
762
sh ./scrips/cpu_hdd_temp.sh

this works for me.

i also use

/mnt/Working/Scripts/zpoolstatus.sh (this script folder is on a data pool so i don't loose them if my boot device fails or breaks)
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
You either forgotten the shebang or you didn't use the root user to execute the script in the CRON task.
 
Top