Maxwell is a disk monitoring and reporting tool for Mac OS X. It uses the IOKit SMART api to check your ATA disks for signs of possible future failure. It can run tests on demand, print a report of the disks performance, or simply report a passing/failing status.
Maxwell has a command line interface, so it can easily be run from scripts. It takes some command line arguments.
pogma:~/SMART/maxwell peter$ ./maxwell -r BSD Path:/dev/disk0 Serial: MRL242L2GVB3ZB Model: HTS548040M9AT00 Firmware: MG2OA53A Device supports S.M.A.R.T. operations SMART self-test supported SMART error logging supported S.M.A.R.T. operations are enabled SMART self-test enabled SMART error logging enabled Off line collection status is 0 Time to complete Off line Data collection: 9 hours, 27 minutes Status is GOOD TEST THRSH VALUE STATUS RAW ------------------------------------------------------------------------------ ( 1) Raw Read Error Rate 62 100 0x0b00 0 ( 2) Throughput Performance 40 100 0x0500 0 ( 3) Spin Up Time 33 232 0x0700 60129542145 ( 4) Start/Stop Count 0 100 0x1200 22 ( 5) Reallocated Sector Count 5 100 0x3300 0 ( 7) Seek Error Rate 67 100 0x0b00 0 ( 8) Seek Time Performance 40 100 0x0500 0 ( 9) Power-On Hours Count ** 0 100 0x1200 346 ( 10) Spin Retry Count 60 100 0x1300 0 ( 12) Device Power Cycle Count 0 100 0x3200 8 (191) Gsense Error Rate 0 100 0x0a00 0 (192) Power Off Retract Count 0 100 0x3200 0 (193) Load/Unload Cycle Count 0 99 0x1200 13091 (194) Device Temperature 0 117 0x0200 249109610543 (196) Reallocation Event Count 0 100 0x3200 0 (197) Current Pending Sector Count 0 100 0x2200 0 (198) Off-Line Scan Uncorrectable Sector Count 0 100 0x0800 0 (199) Ultra DMA CRC Error Count 0 200 0x0a00 0 ------------------------------------------------------------------------------ Device temperature is 38 degrees centigrade ------------------------------------------------------------------------------ Device: HTS548040M9AT00 Reported PASS status
You should probably take many of the items listed with a grain of salt. They are true for my drive, but may be totally wrong for yours. For example, I tried it on one device which reported a temperature of 105 degrees. However, you will find that the Thresholds and Values are what is important. If a value is less than or equal to its threshold then the device is about to fail.
Seagate has a good article on S.M.A.R.T.
See the sourceforge project page for more information. Maxwell.
It has just come to my attention that smartmontools now has darwin support. This may be a better bet than maxwell for your needs.