Page 1 of 1

[SOLVED] Automatic email report after scrub not sent

PostPosted: Sun Apr 30, 2023 5:03 pm
by zfsfan
After configuring /etc/zfs/zed.d/zed.rc as explained at
https://wiki.archlinux.org/title/ZFS#Mo ... _on_Events
and
https://serverfault.com/a/605997
no email report is sent after scrubbing has finished, even with ZED_NOTIFY_VERBOSE=1
I already did a reboot to make sure that zed has read the new config file.
What can I do?

The mail client works (email is received at destination):
Code: Select all
echo "Test"|mail -s 'Testing' email@private-domain.com


And zed is running:
Code: Select all
$ ps aux|grep zed
root               340   0,0  0,0 34156628   3224   ??  Ss   12:09am   0:00.30 /usr/local/zfs/bin/zed -vfF
user              4248   0,0  0,0 34122828    836 s000  S+    2:56am   0:00.00 grep zed
$ sudo launchctl list | grep zed
340   1   org.openzfsonosx.zed
-   0   com.apple.iokit.ioserviceauthorized


Main values in /etc/zfs/zed.d/zed.rc:
Code: Select all
ZED_EMAIL_ADDR="email@private-domain.com"
ZED_EMAIL_PROG="mail"
ZED_EMAIL_OPTS="-s '@SUBJECT@' @ADDRESS@"
ZED_NOTIFY_VERBOSE=1

Re: Automatic email report after scrub not sent

PostPosted: Sun Apr 30, 2023 5:42 pm
by zfsfan
Running the script manually works, the email is sent.
Obviously zed doesn't run the script after scrubbing has finished.

Code: Select all
$ ZED_ZEDLET_DIR=/etc/zfs/zed.d ZEVENT_POOL=backup1 ZEVENT_SUBCLASS=scrub_finish ZPOOL=/usr/local/zfs/bin/zpool /etc/zfs/zed.d/scrub_finish-notify.sh; echo $?
0

Re: Automatic email report after scrub not sent

PostPosted: Sun Apr 30, 2023 6:46 pm
by cgiard
I haven’t tried, but you should make sure the mail command works if run as the root user, not your user account.

Re: Automatic email report after scrub not sent

PostPosted: Mon May 01, 2023 4:23 am
by zfsfan
cgiard wrote:I haven’t tried, but you should make sure the mail command works if run as the root user, not your user account.


As root, OK (0) is returned, but I receive no email:

Code: Select all
# ZED_ZEDLET_DIR=/etc/zfs/zed.d ZEVENT_POOL=backup1 ZEVENT_SUBCLASS=scrub_finish ZPOOL=/usr/local/zfs/bin/zpool /etc/zfs/zed.d/scrub_finish-notify.sh; echo $?
0

Re: Automatic email report after scrub not sent

PostPosted: Mon May 01, 2023 4:30 am
by zfsfan
I have updated the postfix configuration, now receiving email by calling the script as root works. Thanks so far!

Now scrubbing is in progress. Let's see ...

Re: Automatic email report after scrub not sent

PostPosted: Mon May 01, 2023 4:47 am
by zfsfan
It works now.

Thanks a lot!