Ubuntu – Enable ZFS ZED Email Notifications on 16.04

16.04emailnotificationzfs

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:
http://louwrentius.com/the-zfs-event-daemon-on-linux.html


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

Best Answer

I just found your post when trying to set it up, what I did to make it work is:

  1. Uncommented and configured /etc/zfs/zed.d/zed.rc
  2. Set ZED_NOTIFY_VERBOSE=1 in the file /etc/zfs/zed.d/zed.rc
  3. 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:

systemctl restart zed