7

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
  • Did you try sending the mail to a non-gmail account? Also, what is the "from:" address ZED uses? This might be Google's spamfilter not liking that mail... – JanC May 11 '16 at 0:56
3

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!

  • This does not work for me. Any suggestions? – lindhe Jun 18 '17 at 18:28
  • Did you test whether plain sending works? For example by executing echo "Test Email from the new server" | mail -s "Test Subject" root – Martin van Wingerden Dec 23 '17 at 13:52
  • Yeah, that works. And I got ZED working too. Can't remember what I did differently in the end, though. I think it was a bug in ZOL that I had to patch. – lindhe Dec 23 '17 at 14:47
1

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

  • I can not get this to work. Using local postfix from installing mailutils works perfect with zed. So does echo 'Message body' | mail -s 'A subject' me@example.com when I've installed msmtp and msmtp-mta. But even with msmtp-mta installed, zed will not send me mail. Any suggestions? – lindhe Jun 19 '17 at 20:32

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.