how to setup email alert if a HDD is failing or has failed

Red Squirrel

No Lifer
May 24, 2003
70,166
13,573
126
www.anyf.ca
I was playing with the smartctl command and thought of something that would be nice, is there a way to set it up so that if a disk is failing, that it sends me an email alert?

Also is there a way with smartctl to get a status of all drives without having to specify them all? I want to write a generic script that will work on any system that has smartctl.
 

Red Squirrel

No Lifer
May 24, 2003
70,166
13,573
126
www.anyf.ca
how would I set it up to do so then? Figured it would be with smartd but not sure how.

Also would be nice to do the same with mdadm as a raid issue may not actually be a drive failure so smartd would not catch it. (like a disconnected drive)
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
My smartd.conf and mdadm.conf have lots of examples in it to get one started.