Most of this could be done with a shell script, since the SMART values and thresholds are available through my /proc/ide/hd?/smart_* interface.

Apart from the shell script, one needs to have the kernel (Hijack?) issue the command to the drive to tell it to turn on SMART monitoring internally.

Easy stuff.