As ZFS is now officially supported in Ubuntu 16.04, I would like to enable email notifications for my ZFS pool. Below are the steps I have taken so far, however I am now currently stuck:
- Installed msmtp and set it up to work with an external gmail account successfully.
- Uncommented and configured /etc/zfs/zed.d/zed.rc
- Set ZED_NOTIFY_VERBOSE=1
- Ran zpool scrub expecting to receive a notification of the clean scrub, no email is sent
This is the only post that I can find relating to ZFS/ZED configuration, however I was unable to get it to work:
Update: Both responses from Mumblepins and Martin led to the fix. Below are the full steps needed to get this to work:
- Install msmtp and set it up to work with an external email account (gmail or whatever)
- Install s-nail and msmtp-mta packages to map msmtp to the mail command
- Uncomment and configure /etc/zfs/zed.d/zed.rc (keeping ZED_EMAIL_PROG="mail")
- systemctl enable zed
2 Answers
I just found your post when trying to set it up, what I did to make it work is:
- Uncommented and configured
/etc/zfs/zed.d/zed.rc - Set ZED_NOTIFY_VERBOSE=1 in the file
/etc/zfs/zed.d/zed.rc - enable the zed daemon:
systemctl enable zed
Ran a scrub and it works!
Note that if the service is already running, you get the error:
Failed to enable unit: Refusing to operate on linked unit file zed.service.
In that case, just restart it:
4systemctl restart zed
The default zed.rc file uses the command line syntax of the mail client, which allows for a subject line in the command line. msmtp only has the subject in the STDIN. So if you're using a command line in zed.rc of msmtp, you'll need to remove the -s subject part of the command. Otherwise, if msmtp-mta is installed, you can use mail as the client in zed.rc and mail will use msmtp