[SOLVED] zfs/zed.d not sending email

Giganic

Active Member
Aug 19, 2016
25
3
43
I have decided to automate the scrubbing of my pool with the advice provided by @tom from this post ZFS Health and because it is no good scrubbing if you aren't notified of a problem looked in the suggestion at the end of that post about using /etc/zfs/zed.d/zed.rc.

Information about this ZFS Event Daemon is very scarce on the internet and not a lot of mentioned about it's configuration but the config file does a pretty good job and letting you know what you need to setup for things to work. As I want to ensure everything works correctly I ran a scrub on my pool and after completion no email was sent.

Looking at "systemctl status zfs-zed.service" you can see why.
Code:
zfs-zed.service - ZFS Event Daemon (zed)
   Loaded: loaded (/lib/systemd/system/zfs-zed.service; disabled)
   Active: active (running) since Fri 2016-08-26 01:21:06 AEST; 1min 26s ago
     Docs: man:zed(8)
Main PID: 10173 (zed)
   CGroup: /system.slice/zfs-zed.service
           └─10173 /sbin/zed -F

Aug 26 01:21:06 test zed[10173]: ZFS Event Daemon 0.6.5-pve9~jessie (PID 10173)
Aug 26 01:21:06 test zed[10173]: Processing events since eid=26
Aug 26 01:21:20 test zed[10194]: eid=27 class=scrub.start pool=tank
Aug 26 01:22:21 test zed[10270]: eid=28 class=scrub.finish pool=tank
Aug 26 01:22:21 test postfix[10282]: fatal: usage: postfix [-c config_dir] [-Dv] command
Aug 26 01:22:22 test zed[10286]: error: scrub.finish-notify.sh: eid=28: postfix exit=1
root@test:/etc/zfs/zed.d#

It seems the command that zed sends to postfix is invalid, perhaps @tom you can let me know how you were able to successfully able to get this to work? Thanks in advance.

zed.rc configuration
Code:
##
# zed.rc
#
# This file should be owned by root and permissioned 0600.
##

##
# Absolute path to the debug output file.
#
ZED_DEBUG_LOG="/tmp/zed.log"

##
# Email address of the zpool administrator for receipt of notifications;
#   multiple addresses can be specified if they are delimited by whitespace.
# Email will only be sent if ZED_EMAIL_ADDR is defined.
# Disabled by default; uncomment to enable.
#
ZED_EMAIL_ADDR="email@gmail.com"

##
# Name or path of executable responsible for sending notifications via email;
#   the mail program must be capable of reading a message body from stdin.
# Email will only be sent if ZED_EMAIL_ADDR is defined.
#
ZED_EMAIL_PROG="postmail"

##
# Command-line options for ZED_EMAIL_PROG.
# The string @ADDRESS@ will be replaced with the recipient email address(es).
# The string @SUBJECT@ will be replaced with the notification subject;
#   this should be protected with quotes to prevent word-splitting.
# Email will only be sent if ZED_EMAIL_ADDR is defined.
#
#ZED_EMAIL_OPTS="-s '@SUBJECT@' @ADDRESS@"

##
# Default directory for zed lock files.
#
#ZED_LOCKDIR="/var/lock"

##
# Minimum number of seconds between notifications for a similar event.
#
#ZED_NOTIFY_INTERVAL_SECS=3600

##
# Notification verbosity.
#   If set to 0, suppress notification if the pool is healthy.
#   If set to 1, send notification regardless of pool health.
#
ZED_NOTIFY_VERBOSE=1

##
# Pushbullet access token.
# This grants full access to your account -- protect it accordingly!
#   <https://www.pushbullet.com/get-started>
#   <https://www.pushbullet.com/account>
# Disabled by default; uncomment to enable.
#
#ZED_PUSHBULLET_ACCESS_TOKEN=""

##
# Pushbullet channel tag for push notification feeds that can be subscribed to.
#   <https://www.pushbullet.com/my-channel>
# If not defined, push notifications will instead be sent to all devices
#   associated with the account specified by the access token.
# Disabled by default; uncomment to enable.
#
#ZED_PUSHBULLET_CHANNEL_TAG=""

##
# Default directory for zed state files.
#
#ZED_RUNDIR="/var/run"

##
# Replace a device with a hot spare after N checksum errors are detected.
# Disabled by default; uncomment to enable.
#
#ZED_SPARE_ON_CHECKSUM_ERRORS=10

##
# Replace a device with a hot spare after N I/O errors are detected.
# Disabled by default; uncomment to enable.
#
#ZED_SPARE_ON_IO_ERRORS=1

##
# The syslog priority (e.g., specified as a "facility.level" pair).
#
#ZED_SYSLOG_PRIORITY="daemon.notice"

##
# The syslog tag for marking zed events.
#
#ZED_SYSLOG_TAG="zed"
 
UPDATE: Fixed.

If you find yourself in a similar situation uncomment ZED_EMAIL_PROG and leave it as mail and lastly uncomment ZED_EMAIL_OPTS.

After performing those two tweaks I am now able to receive an email notification every time zfs scrubs. If you only wish to be notified on errors set ZED_NOTIFY_VERBOSE to 0.

Hopefully this helps someone.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!