Notifications are useful when services fail.
Sadly, they often get sent to
firstname.lastname@example.org, where they don’t get read because nobody sets up their mta.
nullmailer to the rescue.
sudo apt-get install nullmailer mailutils
220.127.116.11 smtp --port=465 --auth-login --ssl --user=yourSendingEmail@domain.tld --pass=iWonderIfQuotesWorkForSpaces --insecure
The password comes from the app password thing, you need to setup two factor in the gmail account.
To test this, try running
echo "error" | NULLMAILER_NAME="Some Service" mail -s "issue with service" "yourReceivingEmail@domain.tld"
NULLMAILER_NAME is optional, but will set from name instead of just being from yourSendingEmail@domain.tld
That can also be used in cronjobs, or other reporting.
/etc/smartd.conf, we set stuff to hopefully check
/dev/sda for issues and report them.
/dev/sda -M test -s S/../.././02 -H -C 0 -U 0 -m yourReceivingEmail@domain.tld
This should send a test email on daemon start, and run a short test every day at 2:00. The jury is still out as to if it sends a test email every day at 2:00. The test should not report anything unless there are problems.
I never figured out how to set the env var
NULLMAILER_NAME, so the from is just whatever email you’re sending from, but it does report hostname in the topic.
And then finally in
start_smartd=yes to autostart because that’s how you do it I guess?
There is an issue with this if the hard drive fails and gets mounted read only, you don’t get any email from smartd about how the hard drive has issues.
tmpfs /var/spool/nullmailer tmpfs nodev,nosuid,noexec,nodiratime,size=5M 0 0
Somehow run this before nullmailer daemon:
sudo mkdir /var/spool/nullmailer/tmp sudo mkdir /var/spool/nullmailer/queue sudo chown -R mail:root /var/spool/nullmailer/ sudo chmod 755 /var/spool/nullmailer/ sudo chmod 750 /var/spool/nullmailer/queue/ sudo chmod 750 /var/spool/nullmailer/tmp/
Now it’s in a tmpfs!
This was updated 2019-04-02 when I added the tmpfs stuff and rewrote parts.