This does not really works, read this: https://uwot.eu/blog/monitor-hard-disk-smart-status-in-python/
First of all install smartmontools, it has the same name on pretty much every distro:
$ emerge -a1 smartmontools
Proceed to edit its configuration file, at the bottom of the file there is a quick explaination of all the available parameters:
cat/etc/smartd.conf --- DEVICESCAN -H -R 1 -R 5 -R 7 -R 10 -R 11 -R 196 -R 197 -R 199 -R 200 -m email@example.com -n standby,10,q
-H tells smartd to check the result of
overall-health self-assesment test which is pretty much useless,
-R is used to specify a single SMART attribute, if its value changes a mail is sent to firstname.lastname@example.org.
To send emails a MTA must be installed, in centos that is sendmail, in gentoo it is not strictly necessary to have a full fledget MTA installed, nullmailer will suffice.
If it is not already installed:
$ emerge -a1 nullmailer $ emerge --config nullmailer
cat/etc/nullmailer/remotes --- mailserver smtp starttls insecure
This will work only if nullmail can rely on an actual mail server to send the messages for him, in case this is not possible or not practical I would just install sendmail and call it a day.
Enable nullmailer service:
$ rc-update add nullmailer default $ service nullmailer restart
To the smartd add
-M test at the end of DEVICESCAN line and then restart smartd service.
Smartd should send an email every time one of the selected SMART attribues changes.