AlertManager警报通知E-mail模板# AlertManager警报通知 E-mail 模板
#AlertManager配置
#l
# 全局配置项
global:
resolve_timeout: 5m #超时,默认5min
楼宇自控系统
#邮箱smtp服务
smtp_smarthost: 'smtp.qq:587'
smtp_from: 'report@elven.vip'
smtp_auth_username: 'report@elven.vip'
smtp_auth_password: 'xxx密码'
smtp_hello: 'qq'
#smtp_require_tls: false
刘晓庆为什么坐牢#wechat
#wechat_api_url: "qyapi.weixin.qq/cgi-bin/"
wechat_api_corp_id: "wwe518* 企业账号唯⼀ID"
wechat_api_secret: "⾃定义应⽤应⽤的密钥"
# 模板
templates:
- '/alertmanager/*.tmpl'
# 路由
route:
group_by: ['alertname'] # 报警分组依据
group_wait: 20s #组等待时间
group_interval: 20s # 发送前等待时间
repeat_interval: 12h #重复周期
receiver: 'email' # 默认警报接收者
#⼦路由
routes:
- receiver: 'wechat'
match:
severity: test  #标签severity为test时满⾜条件,使⽤wechat警报
# 警报接收者
receivers:
- name: 'email' #警报名称
email_configs:
- to: '228@elven.vip'  # 接收警报的email
html: '{{ template "emai.html" . }}' # 模板
headers: { Subject: " {{ .CommonLabels.instance }} {{ .CommonAnnotations.summary }}" } #标题
- name: 'wechat'  #警报名称
wechat_configs:
- send_resolved: true
to_party: '2'  #接收部门id
agent_id: '1000002'  #应⽤ID
to_user: ''
to_tag: ''
message: '{{ template "wechat.html" . }}'
send_resolved: true 恢复后通知
to_user: 企业⽤户ID
corp_id: 企业账号唯⼀ID 可以在我的企业查看
to_party: 需要发送的组id
怎么成为职业电竞选手
agent_id: 应⽤的 ID,应⽤管理 --> 打开⾃定应⽤查看
api_secret: 应⽤的密钥
打开企业注册
API官⽅⽂档
#email模板
pl
{{ define "emai.html" }}
{{ range .Alerts }}
<pre>
实例: {{ .Labels.instance }}
信息: {{ .Annotations.summary }}
详情: {{ .Annotations.description }}
时间: {{ .StartsAt.Format "2006-01-02 15:04:05" }}
</pre>
{{ end }}
{{ end }}
#模板
pl
{{ define "wechat.html" }}
那年花开月正圆周莹有孩子吗{{- if gt (len .Alerts.Firing) 0 -}}{{ range .Alerts }}
@警报
实例: {{ .Labels.instance }}
信息: {{ .Annotations.summary }}
详情: {{ .Annotations.description }}
时间: {{ .StartsAt.Format "2006-01-02 15:04:05" }}
{{ end }}{{ end -}}
{{- if gt (len .Alerts.Resolved) 0 -}}{{ range .Alerts }}
@恢复
实例: {{ .Labels.instance }}
信息: {{ .Annotations.summary }}游戏取名字
时间: {{ .StartsAt.Format "2006-01-02 15:04:05" }}萧亚轩个人资料
恢复: {{ .EndsAt.Format "2006-01-02 15:04:05" }}
{{ end }}{{ end -}}
{{- end }}
警报通知内容,根据需求配置,我本⼈喜欢内容简洁邮件通知
#通知