Use ZED with msmtp on Debian

Send email notification when things go wrong

Install msmtp and its mta.

1
apt install msmtp msmtp-mta mailutils

Edit /root/.msmtprc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        ~/.msmtp.log

aliases        /etc/aliases

account        alerts
host           SMTP_ADDRESS
port           587
from           SENDER_EMAIL_ADDRESS
user           SMTP_ACCOUNT
password       SMTP_PASSWORD 

account default : alerts

Edit /etc/zfs/zed.d/zed.rc:

  • Change ZED_EMAIL_ADDR to your desired mailbox
  • Uncomment ZED_EMAIL_PROG=mail
  • Uncomment ZED_EMAIL_OPTS and edit value: "-s '@SUBJECT@' @ADDRESS@ -r [email protected]"
  • Uncomment ZED_NOTIFY_VERBOSE=1

    • For testing only, change to 0 to ignore events on healthy pools

Scrub a pool and wait till finish to send a test email.

Published on Jun 22, 2022
JS
Arrow Up