Prometheus系列(四)grafana告警测试

5 篇文章 1 订阅
5 篇文章 1 订阅

创建 contact point 时进行邮件告警测试,报错如下:

"status":"failed","error":"SMTP not configured, check your grafana.ini config file's [smtp] section"

在这里插入图片描述根据报错信息可以判断,是由于 SMTP 服务没有配置导致,因此下一步先来配置 SMTP 服务。

配置文件位置:
# cd /usr/local/grafana-9.2.4/conf/
# vim defaults.ini
(配置文件内容较多,此处只截取 SMTP 相关配置)
[smtp]
enabled = false
host = localhost:25
user =
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password =
cert_file =
key_file =
skip_verify = false
from_address = admin@grafana.localhost
from_name = Grafana
ehlo_identity =
startTLS_policy =

[emails]
welcome_email_on_sign_up = false
templates_pattern = emails/*.html, emails/*.txt
content_types = text/html

*/=========================
对上面两部分内容进行修改。如下:(password是授权码并非密码)
[smtp]
enabled = true
host = smtp.qq.com:587
user = 10507***52@qq.com
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password = pzqfhqpqbtslbbhb
# cert_file =
# key_file =
# skip_verify = true
from_address = 10507***52@qq.com
from_name = Grafana
ehlo_identity =
startTLS_policy =

[emails]
welcome_email_on_sign_up = true
templates_pattern = emails/*.html, emails/*.txt
content_types = text/html

在这里插入图片描述

修改完后,重新启动服务:

# nohup /usr/local/grafana-9.2.4/bin/grafana-server web > /usr/local/grafana-9.2.4/bin/grafana.log 2>&1 &

重新测试:
在这里插入图片描述
检查邮件:
在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值