smartmontools and Jamf

hzimmerman
New Contributor III

I was considering deploying http://www.smartmontools.org to our company's computers and using that along with an extension attribute or two to get detailed information about the S.M.A.R.T. status on internal drives.

It looks relatively painless, but I wanted to see if anyone had been down that road and had any tips.

6 REPLIES 6

bajones
Contributor II

Pretty simple stuff, even though my implementation of it as an extension attribute was fairly remedial. Here's a really old script we used:

#!/bin/bash

smart=`/usr/bin/smartctl disk0 -l error | grep "Errors"`

if [[ "$smart" =~ "No Errors Logged" ]] ; then
    /bin/echo "<result>No Errors</result>"
else
    echo "<result>Errors Detected</result>"
fi

Honestly this was so long ago I can't remember if I wrote this or if I copied it from an old jamfnation post. The only problems I had with it were the ambiguous results (due to my lack of knowledge in parsing the results for specific errors) and as the OS was updated I would have to compile and deploy a new version of smartctl. I mostly used the EA to determine if I should manually invoke the command to inspect the results.

EDIT: Forgot to mention that the script assumes you have already deployed the smartctl binary to /usr/bin

hzimmerman
New Contributor III

That is a pretty good idea. If the EA ever reports a problem, I will be grabbing the machine ASAP anyway. Having the particulars in the EA report does not do much at that point.

Your script is about what I had started coming up with in my head.

calumhunter
Valued Contributor

is this not already provided by the JSS? Or are you trying to get more information?

external image link

bajones
Contributor II

@hzimmerman It gets frustrating if you have a computer with 1 reallocated sector or something fairly innocuous and there's no way that I know of to acknowledge the issue so the computer is in your "SMART Errors" computer group forever. Then, if there is a serious issue later on with that particular hard drive, there is no logic to tell you that the status has changed.

@calumhunter These tools allow you to see the raw SMART data provided by the drive. It is a little more helpful than just a "Verified" or "Failed" status. I have seen drives that suddenly have 30+ bad sectors and still have a SMART status of "Verified". This tool allowed me to recover data before the drive inevitably failed completely. I have also seen drives that have significantly decreased IO performance with "Verified" status. I never really trusted the OS's interpretation of the data so this tool is still helpful.

davidhiggs
Contributor III

@hzimmerman it's definitely worth implementing, as @bajones mentons, this will pickup on things that the Apple tool won't. Bad blocks in particular are quite important in alerting you to drive failure before it happens on regular spinning disks.

that script also assumes the system disk you want to check is on disk0, if you have a mix of new and old machines, it's worth updating that script to detect the disk the system is installed on.

http://www.volitans-software.com/smart_utility.php has a compiled version that has some jamf support.

apizz
Valued Contributor

I have Smart Utility at home, but didn't want to have to buy multiple EDU licenses (they come in batches of 100). I'm in the process of writing a script that collects all the SMART data from smartctl and writes to a log file and PLIST. I'll share once it's finished & tested.