Jump to content

smartctl trend analysis tool?


starcat

Recommended Posts

Running periodically smartctl and seeing how drives are doing is quite essential. I was wondering if there is any wrapper around smartctl which will run it periodically and report trend analysis, increasing error rates with drives, etc. Would be great if that sort of thing can be integrated within unMenu directly and be part of the web interface to unRAID.

 

Link to comment

Yes, I have unMenu installed and that link worked fine for me. Thanks!

You'll find a button for it on the user-scripts page in unMENU.

 

The actual "button" is just a shell script itself, named so unMENU will add it to the user-scrips page, and with a few special comment lines to label and describe the button.

 

It is named  50-unmenu_user_script_smarthist-graph

In my file the top two define the button label and description. 

Two of the following are commented out leaving its contents as:

#define USER_SCRIPT_LABEL SMART History Report

#define USER_SCRIPT_DESCR Run SMART paramater tracking database Report

cd /boot/smarthistory

php smarthistory.php -wake ON -output HTML -graph IMAGE -report ALL

 

It basically needs "php" installed to work, and it needs "smarthistory.php" installed in /boot/smarthistory

 

When you press the button, the URL you gave is the one submitted to the unmenu web-server. 

It in turn runs the shell script and sends the output to your browser.

The script changes directory to /boot/smarthistory and then runs smarthistory.php using the "php" interpreter.

 

Not too bad for 4 lines of script. (To create a working button on a web-page)  ;D

 

Joe L.

Link to comment

cd /boot/smarthistory

php smarthistory.php -wake ON -output HTML -graph IMAGE -report ALL

[/b]

 

Actually that is what you could drop in a cron job and bypass the unMenu server and get consistent collection of smart status.

 

Rob

And, since the "button" is a shell script, you could simply schedule it as the script to run.!  ;D

In other words, the script in cron would be

/boot/unmenu/50-unmenu_user_script_smarthist-graph

Link to comment

I should have thought about that.  I know I didn't want to go back to the web server as it only handles one request at a time.

Yes... The "User-Scripts" buttons are just shell scripts with two special "comments" to define the label and description of the button.  The web-page just renders all the buttons it finds (all those matching the naming pattern for the buttons)

 

You can add buttons for just about anything you like.  If you wanted a button to see the free space you could create one with

#define USER_SCRIPT_LABEL Free Space

#define USER_SCRIPT_DESCR Disk Free Space report

echo "<pre>"

df

 

It just needs to be named with a leading number, followed by "-unmenu_user_script_XXXXXXXXXXXXXXX"  where XXXXXXXXXXXXXXX is anything you like that is descriptive.  The leading number determines where it is put in the list of buttons on the page. (Lower number are towards the top)

 

I specifically made the buttons shells scripts so they could be "developed" and tested without any web-interaction at all.  They can just be run as shell scripts.

 

(an amazing job for scripted code btw)

Yes, it is really amazing what we accomplished with just an "awk" script, even with the small limitation that it cannot handle overlapping requests.   It just means I cannot have embedded .jpg images on a page since only one could be rendered by an "img" tag.  (I don't even handle those tags)

 

Thanks for the feedback though...  The unMENU project was originally conceived to allow people to visualize the suggestions for improving the user-interface.  It evolved into a nice tool in its own right.

 

Joe L.

Link to comment

Just an FYI,

 

It equally easy to create a whole new plugin page in unMENU as it is to create a user-script button.

 

Just create a file named

200-unmenu-smarthistory.cgi

 

Put in it the following 4 lines (yes, it is a shell script too) and put it in the same folder as the other unmenu files.

 

#define ADD_ON_MENU=Smart History

#define ADD_ON_URL=smarthistory

cd /boot/smarthistory

php smarthistory.php -wake ON -output HTML -graph IMAGE -report ALL

 

Then restart the unMENU process and it will re-scan for plug-ins as it re-starts.  The new link will appear in the top menu, and it will be on its own page.

 

More complex web-pages like myMain are a bit more complicated... but you can do whatever you like.  the output of whatever you write is expected to be html, and it is sent to the browser.

 

The output of the new plugin looks like this:

2u6hhso.jpg

 

Not too shabby for 4 lines of shell script.  (These two drives have been spinning in my server since I put it online, a bit over 4 years ago.  There's nothing wrong with them, but the smart history report is warning me they are getting old.  Aren't we all ;))

Link to comment

I hope you have some replacements on hand for those 4-year old Hitachi 500GB drives....that's playing with a wee bit of fire.  You can of course, change the 26000 hour threshold in SmartHistory if you like to keep drives for longer than 3 years.

 

I have an old WD 160GB that I pulled from an old iMac that looks like so:

WD-WCAL94036151: WARNING - Power_On_Hours it is now 31170 (warning threshold is 20000)

 

I could really care less about this drive though.  It is my cache drive and if it goes I will just pull another smaller drive from a machine I have sitting around.

Link to comment

How often do you run SmartHistory (twice a day was mentioned?) and any best practice to add it persistently to crontab, perhaps with an example? Thanks.

smart history is built into BubbaRAID and to be honest I am not sure how often it runs.  All I know is that I periodically check the BubbaRAID homepage and it updates with this status.

 

How often you run it is entirely up to you and how paranoid you are about your drives.  If I were to schedule this I would probably run it once every other day or so, but then most of the drives in my array have not changed and have become pretty stable (except for one seagate 1TB which is giving me fits; hopefully fixed that though).

Link to comment

Joe, I was wondering why preclear isn't part of the unMenu User Scripts page? Is there any particular reason? Thanks!

It needs to be interactive... to be able to get confirmation you are not accidentally clearing the wrong drive, and to constantly update the display to show its progress.  In its present form there is no easy way to make it into a web-page.

 

Joe L.

 

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...