Enable ZFS ZED Email Notifications on 16.04

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

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