告警-微信

修改alertmanager.yml

global:
  resolve_timeout: 2m
  smtp_smarthost: 'smtp.163.com:25'
  smtp_from: 'alizabbix@163.com'
  smtp_auth_username: 'alizabbix@163.com'
  smtp_auth_password: 'aabb1122'
  smtp_require_tls: false
templates:
  - 'xxxx/wechat.tmpl'            # 微信摸版路径
route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h 
  receiver: 'wechat'               # 优先使用wechat报警
  routes:
  - receiver: mail
    match_re:
      serverity: mail              # 匹配到serverity时mail的使用邮件报警,这里的serverity是rules文件中的labels指定的
receivers:
- name: 'mail'
  email_configs:
  - to: 'xxx@xxx.com'
    send_resolved: true
- name: 'wechat'
  wechat_configs:
  - corp_id: 'xxx'  #企业ID
    to_party: 'xxx'   #组id
    agent_id: 'xxx'   #agentid
    api_secret: 'xxxx'    #生成的secret
    send_resolved: true

只告警,恢复后不发送消息

带恢复告警的模版 注:需要在alertmanager.yml的wechat_configs中加上配置send_resolved: true

Last updated