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

ethereal

Guru
Joined
Sep 10, 2012
Messages
762
INTEL SSD 320 SERIES
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,079
@Bidule0hm: I love your work. Thank you very much. I was curious if you would make a modification to this scripts?
Display drives identification infos (Device, GPTID, Serial)

This script is particularly useful when you have to replace a failed drive and you don't know which drive is which for example.

For me, and I am not sure why, there are two drives in my system that did not get GPTID assigned to them. This causes the output to be distorted.
Can this be handled (for formatting) in the script? Here is the example:
Code:
+--------+--------------------------------------------+-----------------+
| da13  | gptid/9fc3e3ac-23a8-11e6-adef-002590aecc79 | MK0173YFKBHVSC  |
+--------+--------------------------------------------+-----------------+
glabel: No such geom: ada0p2.
| ada0  |  | NZ05T7725BA8  |
+--------+--------------------------------------------+-----------------+
glabel: No such geom: ada1p2.
| ada1  |  | NZ05T7725BC1  |
+--------+--------------------------------------------+-----------------+
| da2  | gptid/cc2cc752-2391-11e6-83db-002590aecc79 | S1DBNSAFB29210Z |
+--------+--------------------------------------------+-----------------+


When I am able to shut my system down I will do some troubleshooting to see if I can get a gptid to be assigned, but the system will be busy for a while as I am copying about 7 TB of data to it.

I was wondering if you might also be willing to add another column that would tell the current temperature of the drive?

Once again, thank you very much for your contributions.
 
Last edited:

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,079
Interesting that it's missing the SSD temperature. All of my SSDs return it. What model of SSD are you using?

I actually have a Kingston SSD in one of my systems that reports a temperature and a Samsung EVO 840 in another system that does not report a temp.
I am not sure why.
The Kingson drive is connected to a SATA controller where the Samsung drive is connected to a SAS HBA.
I have not tested other configurations to see if it might be the drive or the controller.
 

ethereal

Guru
Joined
Sep 10, 2012
Messages
762
my intel does not report the temperature either - it is ssd specific
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
@Bidule0hm: I love your work. Thank you very much. I was curious if you would make a modification to this scripts?


For me, and I am not sure why, there are two drives in my system that did not get GPTID assigned to them. This causes the output to be distorted.
Can this be handled (for formatting) in the script? Here is the example:
Code:
+--------+--------------------------------------------+-----------------+
| da13  | gptid/9fc3e3ac-23a8-11e6-adef-002590aecc79 | MK0173YFKBHVSC  |
+--------+--------------------------------------------+-----------------+
glabel: No such geom: ada0p2.
| ada0  |  | NZ05T7725BA8  |
+--------+--------------------------------------------+-----------------+
glabel: No such geom: ada1p2.
| ada1  |  | NZ05T7725BC1  |
+--------+--------------------------------------------+-----------------+
| da2  | gptid/cc2cc752-2391-11e6-83db-002590aecc79 | S1DBNSAFB29210Z |
+--------+--------------------------------------------+-----------------+


When I am able to shut my system down I will do some troubleshooting to see if I can get a gptid to be assigned, but the system will be busy for a while as I am copying about 7 TB of data to it.

I was wondering if you might also be willing to add another column that would tell the current temperature of the drive?

Once again, thank you very much for your contributions.

Looks like it's because they are multipath but I'm not sure.

I will not add the temp because this script is only to identify the drives and there's already another script with the temps and the other useful SMART infos ;)
 

wtfR6a

Explorer
Joined
Jan 9, 2016
Messages
88
I could do with some bash / awk consultation - trying to adjust this script to extract some data from my NVMe drives and want to tidy up the display a bit.

Code:
Data Units Read:                    322,661,649 [165 TB]


I want to extract the '165' from the 165 TB line which I did like this...

Code:
/Data Units Written:/{DataWrote=(substr($5,2));} \


which I think is fine and should continue to work as the value increases, right?

This one has me beat though...

Code:
Power On Hours:                    1,244


How can I remove the ',' (or multiple commas as the value grows). I there a way to strip all non-numeric characters from the value ???

thx in adv
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Please start your own thread, I'll help you here ;)
 

sv2241

Dabbler
Joined
Apr 14, 2016
Messages
11
First of all thanks for these great scripts.
I have a problem with running them - the output is sent to my e-mail address when running them manually from the OS or when pressing the "Run Now" button but not through cron. Is there a known bug with cron or something that I missed?

WAcVKy4.png
 

ethereal

Guru
Joined
Sep 10, 2012
Messages
762
do you have them enabled?
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Can you run them manually with the exact same command you put in the cron? (/mnt/tank/ ... /FreeNAS/zpool_report.sh for example)
 

sv2241

Dabbler
Joined
Apr 14, 2016
Messages
11
The scripts are enabled and all of them have been run manually before they were added in cron section of the FreeNAS GUI. When they're run manually I don't get any syntax errors and I do get the e-mail reports immediately after.

Code:
[root@storage01 ~]# /mnt/tank/media/Library/Scripts/FreeNAS/zpool_report.sh
[root@storage01 ~]#
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Ok. And you have the same problem with all the scripts?
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
I have no idea on what's going on here... Anyone has an idea?
 

ethereal

Guru
Joined
Sep 10, 2012
Messages
762
perhaps it has something to do with permissions?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
How would that result in a syntax error?
 

ethereal

Guru
Joined
Sep 10, 2012
Messages
762
they didn't say that they got a syntax error.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Are you running them as root? And is root's shell set to /bin/csh?
 

Ericloewe

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