如需了解完整内容请访问https://www.emperinter.info/2020/12/11/config-email-notifications-of-netdata/
自己上午搭建好NETDATA并配置好Telegram预警后就尝试了一下配置EMAIL,教程如下!
-
我这里用的DOCKER搭建的,如非docker以下教程仅作参考!
-
官网参考地址 | https://learn.netdata.cloud/docs/agent/health/notifications/email
NETDATA配置
请参考NETDATA
邮件信息获取
这个没啥好说的!我自己用域名搭建了了一个邮件服务器!如果是其它邮件请自行搜索!这里的配置是不能有SSL协议的,docker里面的cert有问题!
进入NETDATA DOCKER 环境
注意替换为你自己服务器分配的CONTAINER ID
docker ps
docker exec -it bab6e102f429 /bin/bash
配置msmtp
配置
vi /root/.msmtprc
- 配置文件参考(请按照配置说明和自己服务器情况自行更改,不要做只会从copy的脑残)如下:
# Example for a user configuration file ~/.msmtprc
#
# This file focusses on TLS and authentication. Features not used here include
# logging, timeouts, SOCKS proxies, TLS parameters, Delivery Status Notification
# (DSN) settings, and more.
# Set default values for all following accounts.
defaults
# Use the mail submission port 587 instead of the SMTP port 25.
port 587
# Always use TLS.
tls on
# Set a list of trusted CAs for TLS. The default is to use system settings, but
# you can select your own file.
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
# A freemail service
account freemail
# Host name of the SMTP server
host smtp.freemail.example
# As an alternative to tls_trust_file, you can use tls_fingerprint
# to pin a single certificate. You have to update the fingerprint when the
# server certificate changes, but an attacker cannot trick you into accepting
# a fraudulent certificate. Get the fingerprint with
# $ msmtp --serverinfo --tls --tls-certcheck=off --host=smtp.freemail.example
#tls_fingerprint 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
# Envelope-from address
from joe_smith@freemail.example
# Authentication. The password is given using one of five methods, see below.
auth on
user joe.smith
# Password method 1: Add the password to the system keyring, and let msmtp get
# it automatically. To set the keyring password using Gnome's libsecret:
# $ secret-tool store --label=msmtp \
# host smtp.freemail.example \
# service smtp \
# user joe.smith
# Password method 2: Store the password in an encrypted file, and tell msmtp
# which command to use to decrypt it. This is usually used with GnuPG, as in
# this example. Usually gpg-agent will ask once for the decryption password.
passwordeval gpg2 --no-tty -q -d ~/.msmtp-password.gpg
# Password method 3: Store the password directly in this file. Usually it is not
# a good idea to store passwords in cleartext files. If you do it anyway, at
# least make sure that this file can only be read by yourself.
#password secret123
# Password method 4: Store the password in ~/.netrc. This method is probably not
# relevant anymore.
# Password method 5: Do not specify a password. Msmtp will then prompt you for
# it. This means you need to be able to type into a terminal when msmtp runs.
# A second mail address at the same freemail service
account freemail2 : freemail
from joey@freemail.example
# The SMTP server of your ISP
account isp
host mail.isp.example
from smithjoe@isp.example
auth on
user 12345
# Set a default account
account default : freemail
- 我的配置
defaults
port 465
tls off
account freemail
host xxx.
from blog@emperinter.info
auth login # 这里不能用on,否则会报错
user blog@emperinter.info
password xxxxxxxxxx
account default : freemail
测试配置
msmtp your@email.com
请注意替换为你收件邮箱,回车后输入发送内容,按CTRL+D发送。若邮件接收成功则配置成功,若失败则有相关提示信息!
配置NETDATA发送邮件
…
如需了解完整内容请访问https://www.emperinter.info/2020/12/11/config-email-notifications-of-netdata/