准備工作
step 1: 訪問網站 注冊企業微信賬號(不需要企業認證)。
step 2: 訪問apps 創建第三方應用,點擊創建應用按鈕 -> 填寫應用信息:


prometheus 配置:
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- localhost:9093
rule_files:
- "rules.yml"
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
rules.yml 配置:
groups:
- name: node
rules:
- alert: server_status
expr: up{job="node"} == 0
for: 15s
annotations:
summary: "機器 {{ $labels.instance }} 掛了"
alertmanger 配置:
route:
group_by: ['alertname']
receiver: 'wechat'
receivers:
- name: 'wechat'
wechat_configs:
- corp_id: 'xxx'
to_party: '1'
agent_id: '1000002'
api_secret: 'xxxx'
參數說明:
- corp_id: 企業微信賬號唯一 ID, 可以在
我的企業中查看。 - to_party: 需要發送的組。
- agent_id: 第三方企業應用的 ID,可以在自己創建的第三方企業應用詳情頁面查看。
- api_secret: 第三方企業應用的密鑰,可以在自己創建的第三方企業應用詳情頁面查看。
詳情請參考文檔。
