更新grafana 邮件配置
# 部署见连接: https://cloud.prd.emal.cc/index.php/archives/92/
# 在docker-compose.yaml 里面添加映射将这个配置文件里面的[smtp]启用
- ./grafana/conf/grafana.ini:/etc/grafana/grafana.ini #在docker-compose.yaml添加这样
修改文件grafana.ini
[smtp]
enabled = true
host = smtp.163.com:465
user = demo@163.com #改成你的邮箱
password = SDCFWRDXCGGHNJKB #改成你的邮箱16位授权码
skip_verify = true
from_address = demo@163.com #改为你的邮箱
from_name = Grafana
# 完成后启动docker-compose
docker-compose down && docker-compose up -d
编辑grafana页面创建告警

{{ define "alert" }}
{{- if gt (len .Alerts.Firing) 0 -}}{{ range .Alerts }}
===============================
@告警通知
告警程序: Grafana
告警级别: {{ .Labels.severity }}
告警类型: {{ .Labels.alertname }}
故障主机: {{ .Labels.instance }}
告警主题: {{ .Annotations.summary }}
告警详情: {{ .Annotations.description }}
触发时间: {{ .StartsAt.Local.Format "2006-01-02 15:04:05" }}
静默地址: https://grafana.prd.emal.cc/alerting/list
===============================
{{ end }}{{ end -}}
{{- if gt (len .Alerts.Resolved) 0 -}}{{ range .Alerts }}
===============================
@告警恢复
告警程序: prometheus_alert
故障主机: {{ .Labels.instance }}
故障主题: {{ .Annotations.summary }}
告警详情: {{ .Annotations.description }}
告警时间: {{ .StartsAt.Local.Format "2006-01-02 15:04:05" }}
恢复时间: {{ .EndsAt.Local.Format "2006-01-02 15:04:05" }}
===============================
{{ end }}{{ end -}}
{{ end }}




- 更多里面你可以开启静默这些操作等

评论 (0)