3

Now that I have a failed HDD, I think it is time to setup ZFS ZED. I am using Ubuntu 16.04 with LXD and have a postfix mail server listening to port 1478 in a container (which works, it is tested and proven that it works).

Now the question is, how do I configure ZED so that it uses this mail server? I could not find any information on actually configuring it.

JonathanDavidArndt
  • 1,414
  • 3
  • 20
  • 29
OmerSakar
  • 43
  • 6
  • Isn't postfix an MTA? So I would just need to point ZED to it, but I could not find any examples or documentation. – OmerSakar Feb 27 '18 at 21:54
  • Yes, but you need a mail client that can talk to the MTA, which is `mail`. Mail then drops that into the `sendmail` queue which then can send to other MTA's (like Postfix). Or you might have `exim` or any other MTA already installed. – Andrew Feb 27 '18 at 22:11
  • ZED doesn’t send messages itself but uses another program like sendmail to do that. In the case of sendmail, you would have to configure that for your postfix setup. – John Keates Feb 28 '18 at 00:47

2 Answers2

3

It’s really easy.

Add an email address to the zed.rc file. The format should have an entry that allows uncommenting a field and inputting an address.

Do you have anything in the file yet? This will depend on distribution and ZFS version, but check /etc/zfs/zed.d/zed.rc

On recent ZFS distributions, you'll see:

# 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="systems@pshunter.net"
ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • The `zed.rc` has some configuration. I did as you suggested here, but the problem is that the program `mail` is not installed. As far as I understand, `mail` is in the package `mailutils` which automatically installs postfix as well. Is there a way to install mail without postfix, since I already have a postfix instance in a container? – OmerSakar Feb 28 '18 at 08:50
1

I'm not familiar with ZED specifically, but I'm guessing it's not connecting directly via SMTP.

You'll likely have to setup an MTA on the box to send the email. On Debian, this is typically exim4. This would then need to be configured to send via your Postfix container to the actual internet.

Looking at the zed.rc file, it seems that it's just calling your local mail program:

25 #ZED_EMAIL_PROG="mail"

So as long as mail can send email to the world, just configure the email address in the zed.rc file as needed, and you should start getting email.

Andrew
  • 2,057
  • 2
  • 16
  • 25
  • Aa okay, I forgot one step. I misunderstood what `ZED_EMAIL_PROG` was (stupid mistake of mine). The problem I had was that mailutils was not installed. However when I install mailutils (which contains the program called `mail`) I automatically install postfix as well. Is there a way to not install Postfix, since I already have one which is in a container – OmerSakar Feb 28 '18 at 08:48
  • `mail` needs something. Often `exim4` or `sendmail` are used – Andrew Feb 28 '18 at 18:11