Prometheus AlertManager 实现微信告警

1 注册企业微信


登陆网址:

企业微信https://work.weixin.qq.com/

找到应用管理,创建应用。应用名字wechat,建成功之后显示如下: 

注意这个secret在电脑上是看不到的,要在手机版里面才可以看到

使用登录微信后台的超管账号登录手机端企业微信app,有个消息,打开就能看到了。

 AgentId:1000003

Secret:Ov5SWq_JqrolsOj6dD4Jg9qaMu1TTaDzVTCrXHcjlFs

2.修改alertmanager-cm.yaml


global:
    smtp_smarthost: 'smtp.163.com:25'
    smtp_from: '1501157****@163.com'
    smtp_auth_username: '1501157****'
    smtp_auth_password: '19893****'
    smtp_require_tls: false
route:
    group_by: [alertname]
    group_wait: 10s
    group_interval: 10s
    repeat_interval: 3m
    receiver: "prometheus"
receivers:
- name: 'prometheus'
  wechat_configs:
  - corp_id: wwa82df90a693abb15
    to_user: '@all'
    agent_id: 1000003
    api_secret: Ov5SWq_JqrolsOj6dD4Jg9qaMu1TTaDzVTCrXHcjlFs

参数说明:

  • secret: 企业微信("企业应用"-->"自定应用"[Prometheus]--> "Secret")
  • wechat是本人自创建应用名称
  • corp_id: 企业信息("我的企业"--->"CorpID"[在底部])
  • agent_id: 企业微信("企业应用"-->"自定应用"[Prometheus]--> "AgentId")
  • wechat是自创建应用名称 #在这创建的应用名字是wechat,那么在配置route时,receiver也应该是Prometheus
  • to_user: '@all' :发送报警到所有人

猜你喜欢

转载自blog.csdn.net/qq_34556414/article/details/121566118