There was still something strange going on with the sendmail setup: If I used the line in one of the posts above
Code: Select all
echo test 1 2 | mail -s "Some test message" firstname.lastname@example.org
to test the mail forwarding it worked fine. The mail was forwarded to my external mail address. However, mail from greyhole stayed on the server.
I decided to change the /etc/aliases file: on the bottom of the file is a line that's commented out:
Code: Select all
# Person who should get root's mail
I've changed the alias after root: to one of my own real, existing e-mail addresses. After that it worked, and greyhole's status mail's were send to my external address.
I fully believe that this is not the best way to setup mail to an external address, but until someone with some real sendmail knowledge steps in, ill keep it this way
Back to the original topic: Alerting the user for disk errors
I found that the package 'smartmontools' (http://smartmontools.sourceforge.net/
) was already present and setup on my system but wasn't running. smartmontools is a free software package that can monitor S.M.A.R.T. attributes and run hard drive self-tests. Basically, S.M.A.R.T. may give you enough of a warning that you can safely backup all your data before your hard drive dies. Obviously, nothing replaces regular backups, but it's absolutely better than knowing nothing!
If it isn't installed on your system you can do that by using a terminal as root:
smartmontools comes with two programs: smartctl which is meant for interactive use and smartd which continuously monitors S.M.A.R.T.
You can do a quick test to see if it recognizes your drives:
(replace /dev/sda by the drive(s) present on your system)
To setup smartd to monitor your system automatically, edit the file /etc/smartd.conf: check for a line that begins with DEVICESCAN. Comment it out by adding a ‘#’ to the beginning of the line. Add the following line to /etc/smartd.conf:
Code: Select all
/dev/sda -n standby -a -I 194 -W 6,45,55 -R 5 -M daily -M test -m email@example.com
I've used an example from the config file that I modified to suit my needs.
- '/dev/sda' is the drive you want to monitor
'-n standby' will not wake up the drive if it is 'sleeping' or in 'standby' to poll it for status
'-a' contains the most common options. you probably want this
'-I 194' don't monitor normalized temperature changes, but...
'-W 6,45,5' track temperature changes >= 6 Celsius, report temperatures >= 45 Celsius; send mail when temperature >= 55 celcius
'-R 5' changes in Raw value of Reallocated Sector Count.
'-M daily' send reports daily. (The default is to send only one warning email for each type of disk problem)
'-M test' send a single test email immediately upon smartd startup. This allows one to verify that email is delivered correctly.
'-m firstname.lastname@example.org' Send a warning email to the email address email@example.com (replace that with root@your_systems_hostname)
You'll need a line like that for every drive in the server you want to monitor.
I'd advice you to check the man page for smartd to see all the available options. There are a lot of them....
Start the daemon with:
If you want it to restart after a reboot:
It seems to work on my system, but so far my drives are fine and I dont have a lot to report (lucky me!). The test mails for all my drive were forwarded properly. Smartd uses as default location for notifications and warnings /var/log/messages. You can check this to monitor it's operation
I'll report back if I have more information and/or additions.
It would be nice if the development time could find a way to integrate this into Amahi!