How to configure ZED to send mail?

1,045 views
Skip to first unread message

Dan Swartzendruber

unread,
Jun 8, 2016, 9:27:44 AM6/8/16
to esos-users

The default executable it wants is 'mail'.  There is apparently no such executable.  Note that whatever is used needs to use the same syntax,  At least to the extent that you would say 'MAILPROG -s SUBJECT som...@somewhere.com'.  Any thoughts?

Marc Smith

unread,
Jun 8, 2016, 3:12:21 PM6/8/16
to esos-...@googlegroups.com
Where is that documented? I don't see anything about "mail" in 'man
zed' and there doesn't appear to be a direct reference in the binary:

[root@localhost ~]# strings /usr/sbin/zed | grep -i mail
[root@localhost ~]#

Or is it a build-time option that needs to be enabled with ZFS?

--Marc
> --
> You received this message because you are subscribed to the Google Groups
> "esos-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to esos-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Dan Swartzendruber

unread,
Jun 8, 2016, 3:17:23 PM6/8/16
to esos-...@googlegroups.com
On 2016-06-08 15:12, 'Marc Smith' via esos-users wrote:
> Where is that documented? I don't see anything about "mail" in 'man
> zed' and there doesn't appear to be a direct reference in the binary:
>
> [root@localhost ~]# strings /usr/sbin/zed | grep -i mail
> [root@localhost ~]#
>
> Or is it a build-time option that needs to be enabled with ZFS?

/usr/etc/zfs/zed.d/zed.rc

Marc Smith

unread,
Jun 8, 2016, 3:28:04 PM6/8/16
to esos-...@googlegroups.com
You mean "/etc/zfs/zed.d/zed.rc"?

--snip--
# Requires the mail executable to be installed in the standard PATH, or
# ZED_EMAIL_PROG to be defined with the pathname of an executable capable of
# reading a message body from stdin.
--snip--

And:

--snip--
# Command-line options to the mail executable can be specified in
# ZED_EMAIL_OPTS. This undergoes the following keyword substitutions:
# - @ADDRESS@ is replaced with the space-delimited recipient email address(es)
# - @SUBJECT@ is replaced with the notification subject
--snip--

So maybe you can use sendmail for ZED_EMAIL_PROG and modify
ZED_EMAIL_OPTS to accommodate sendmail?


--Marc

Dan Swartzendruber

unread,
Jun 8, 2016, 3:30:11 PM6/8/16
to esos-...@googlegroups.com
On 2016-06-08 15:28, 'Marc Smith' via esos-users wrote:
> You mean "/etc/zfs/zed.d/zed.rc"?

my install has the zed stuff under /usr


Marc Smith

unread,
Jun 8, 2016, 3:31:12 PM6/8/16
to esos-...@googlegroups.com
Hmm... sounds like we need to set --sysconfdir in our Makefile instead
of letting it guess. =)

Marc Smith

unread,
Jun 8, 2016, 3:40:45 PM6/8/16
to esos-...@googlegroups.com
I updated it for both 'zfs' and 'spl':

diff --git a/Makefile.in b/Makefile.in
index 57102c2..e4a9ec0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -798,12 +798,13 @@ esos_kernels: kernel_headers $(if $(findstring
yes,$(enable_zfs)),glibc gcc util
fi; \
if [ "$(enable_zfs)" = "yes" ]; then \
$(ECHO) "### Building the SPL and ZFS modules..."; \
- cd $(spl_src) && ./configure --prefix=/usr \
+ cd $(spl_src) && ./configure --prefix=/usr --sysconfdir=/etc \
--with-linux=$(linux_src) --with-linux-obj=$(linux_src); \
$(MAKE) --directory=$(spl_src)/module modules; \
$(MAKE) --directory=$(spl_src)/module modules_install \
DESTDIR=$(IMAGE_DIR); \
- cd $(zfs_src) && $(SED) -i 's/CDDL/GPL/' META &&
./configure --prefix=/usr \
+ cd $(zfs_src) && $(SED) -i 's/CDDL/GPL/' META && ./configure \
+ --prefix=/usr --sysconfdir=/etc \
--with-linux=$(linux_src) --with-linux-obj=$(linux_src) \
--with-spl=$(spl_src) --with-spl-obj=$(spl_src) \
--with-udevdir="/usr/lib/udev"; \

I haven't tested the build yet, but once I do, I will push this commit.


--Marc

Dan Swartzendruber

unread,
Jun 8, 2016, 3:43:22 PM6/8/16
to esos-...@googlegroups.com
On 2016-06-08 15:40, 'Marc Smith' via esos-users wrote:

I'm confused. This will move the stuff to /etc, but the issue of not
having a usable 'mail' program is still there?

Marc Smith

unread,
Jun 8, 2016, 3:44:24 PM6/8/16
to esos-...@googlegroups.com
Why can't you use sendmail? There is currently no "mail" binary in
ESOS (which is why you can't find it).

Dan Swartzendruber

unread,
Jun 8, 2016, 3:57:55 PM6/8/16
to esos-...@googlegroups.com
On 2016-06-08 15:44, 'Marc Smith' via esos-users wrote:
> Why can't you use sendmail? There is currently no "mail" binary in
> ESOS (which is why you can't find it).

I suppose I could. Back at the beginning of this thread, I was
wondering about what to use. I'll give that a try later...

Dan Swartzendruber

unread,
Jun 8, 2016, 4:03:45 PM6/8/16
to esos-...@googlegroups.com
On 2016-06-08 15:44, 'Marc Smith' via esos-users wrote:
> Why can't you use sendmail? There is currently no "mail" binary in
> ESOS (which is why you can't find it).

okay, later ended up being now lol. anyway, a problem right off the
bat: the zed code assumes the 'mail' program, which has a '-s xxx'
option, where 'xxx' is the subject. Sendmail does not support this. If
you login to an esos box and do this:

sendmail SOMEADDR
lkflkgfkgfl
^D

it will work.

if you try:

sendmail -s SSSS SOMEADDR
kfglkfkgfklgfl
^D

the message goes through, but apparently sendmail tries to do something
funky with the '-s SSSS' and you get a weird bounce...

Marc Smith

unread,
Jun 8, 2016, 4:10:25 PM6/8/16
to esos-...@googlegroups.com
Right, you would omit the '-s' argument when setting ZED_EMAIL_OPTS.
You MAY get away with "sendmail Subject: '@SUBJECT@'" as both read
from stdin I believe. And if that doesn't work, perhaps we can look at
including the "mail" program in ESOS. I'm sure we're not lucky enough
to have it already in Busybox (might need a config option set to
enable)?

Dan Swartzendruber

unread,
Jun 8, 2016, 4:10:55 PM6/8/16
to esos-...@googlegroups.com

My main motivation here was wanting to detect pool issues. I figured
out how to get nrpe working with check_zpools.sh, so this is not a
priority (for me at any rate...)

Marc Smith

unread,
Jun 8, 2016, 4:12:07 PM6/8/16
to esos-...@googlegroups.com
Didn't we add something into health_chk.sh to check for
offline/degraded ZFS storage pools, or is that not enough?

Dan Swartzendruber

unread,
Jun 8, 2016, 4:13:03 PM6/8/16
to esos-...@googlegroups.com
On 2016-06-08 16:10, 'Marc Smith' via esos-users wrote:
> Right, you would omit the '-s' argument when setting ZED_EMAIL_OPTS.
> You MAY get away with "sendmail Subject: '@SUBJECT@'" as both read
> from stdin I believe. And if that doesn't work, perhaps we can look at
> including the "mail" program in ESOS. I'm sure we're not lucky enough
> to have it already in Busybox (might need a config option set to
> enable)?

Right. But you'd have to diddle zed.rc and company, which gets ugly.
If I had my druthers, I'd just put adding 'mail' to busybox on the
low-priority list of things to do...

Dan Swartzendruber

unread,
Jun 8, 2016, 4:15:29 PM6/8/16
to esos-...@googlegroups.com
On 2016-06-08 16:12, 'Marc Smith' via esos-users wrote:
> Didn't we add something into health_chk.sh to check for
> offline/degraded ZFS storage pools, or is that not enough?

Well, crap, you're right. Totally forgot about that :( I was playing
with this and took a drive offline to test, but I put it back online
right away after confirming the nagios stuff detected the degraded pool.
The health check script runs every 10 minutes? so I presume I did this
too fast to see it...


Marc Smith

unread,
Jun 8, 2016, 4:20:09 PM6/8/16
to esos-...@googlegroups.com
I think its 10, or 5, but you can edit /etc/crontab to your liking and
set it more often.
Reply all
Reply to author
Forward
0 new messages