自己上午搭建好NETDATA并配置好Telegram预警后就尝试了一下配置EMAIL,教程如下!

  • 我这里用的DOCKER搭建的,如非docker以下教程仅作参考!

  • 官网参考地址 | https://learn.netdata.cloud/docs/agent/health/notifications/email

NETDATA配置

请参考NETDATA

邮件信息获取

这个没啥好说的!我自己用域名搭建了了一个邮件服务器!如果是其它邮件请自行搜索!这里的配置是不能有SSL协议的,docker里面的cert有问题!

  • 私人邮箱搭建教程

进入NETDATA DOCKER 环境

注意替换为你自己服务器分配的CONTAINER ID

docker psdocker exec -it bab6e102f429 /bin/bash

配置msmtp

配置

vi /root/.msmtprc

  • 配置文件参考(请按照配置说明和自己服务器情况自行更改,不要做只会从copy的脑残)如下:

原参考地址https://marlam.de/msmtp/msmtprc.txt

# 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 serviceaccount freemail# Host name of the SMTP serverhost 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 addressfrom joe_smith@freemail.example# Authentication. The password is given using one of five methods, see below.auth onuser 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 serviceaccount freemail2 : freemailfrom joey@freemail.example# The SMTP server of your ISPaccount isphost mail.isp.examplefrom smithjoe@isp.exampleauth onuser 12345# Set a default accountaccount default : freemail

  • 我的配置
defaultsport 465tls offaccount freemailhost xxx.from blog@emperinter.infoauth login  # 这里不能用on,否则会报错user blog@emperinter.infopassword xxxxxxxxxxaccount default : freemail

测试配置

msmtp your@email.com

请注意替换为你收件邮箱,回车后输入发送内容,按CTRL+D发送。若邮件接收成功则配置成功,若失败则有相关提示信息!

配置NETDATA发送邮件


©著作权归作者所有:来自51CTO博客作者emperinter的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. Nginx 1.18.0配置SSL问题
  2. 模模搭古城搭建学习笔记4:完结篇
  3. Maven安装与Eclipse配置
  4. Django 日志配置
  5. lnmp一键安装包搭建lnmp环境,二种方式
  6. MySQL高可用之mysql+keepalived
  7. LVS+KeepAlived+Nginx高可用实现方案
  8. Django 配置MySQL作为后端数据库
  9. Nginx配置文件详解及多站点配置

随机推荐

  1. Android(安卓)管理多个fragment(处理Acti
  2. android 地理位置共享服务
  3. 《Android面试宝典》学习笔记(第四章:对话
  4. Android 给贪吃蛇游戏加背景音乐
  5. Android:adb常用命令汇总
  6. 下载adt-bundle-linux-x86_64-20140702.z
  7. g1安装android软件详细攻略
  8. Android的多媒体技术――MediaPlayer实现
  9. android中进行https连接的方式的详解
  10. Android TextView中显示单行过长的用...