准备工作

step 1: 访问网站 注册企业微信账号(不需要企业认证)。

step 2: 访问apps 创建第三方应用,点击创建应用按钮 -> 填写应用信息:

prometheus 通过企业微信接收告警

 

 prometheus 通过企业微信接收告警

 

prometheus 配置:

prometheus 通过企业微信接收告警
# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      - localhost:9093

rule_files:
  - "rules.yml"

scrape_configs:
  - job_name: 'node'
    static_configs:
      - targets: ['localhost:9100']
prometheus 通过企业微信接收告警

rules.yml 配置:

prometheus 通过企业微信接收告警
groups:
- name: node
  rules:
  - alert: server_status
    expr: up{job="node"} == 0
    for: 15s
    annotations:
      summary: "机器 {{ $labels.instance }} 挂了"
prometheus 通过企业微信接收告警

alertmanger 配置:

prometheus 通过企业微信接收告警
route:
  group_by: ['alertname']
  receiver: 'wechat'

receivers:
- name: 'wechat'
  wechat_configs:
  - corp_id: 'xxx'
    to_party: '1'
    agent_id: '1000002'
    api_secret: 'xxxx'
prometheus 通过企业微信接收告警

参数说明:

  • corp_id: 企业微信账号唯一 ID, 可以在我的企业中查看。
  • to_party: 需要发送的组。
  • agent_id: 第三方企业应用的 ID,可以在自己创建的第三方企业应用详情页面查看。
  • api_secret: 第三方企业应用的**,可以在自己创建的第三方企业应用详情页面查看。

详情请参考文档

相关文章:

  • 2022-12-23
  • 2021-07-08
  • 2021-04-01
  • 2021-08-09
  • 2021-11-04
  • 2021-12-05
猜你喜欢
  • 2021-12-15
  • 2022-01-14
  • 2022-12-23
  • 2021-07-17
  • 2021-11-29
  • 2021-06-10
相关资源
相似解决方案