alertmanager
支持email,webhook等報警源支持,看到能夠支持微信報警信息推送以爲有意思把玩一下,alertmanager
的0.15
版本微信報警推送有問題,後來我把版本降到0.14
後微信就能正常收到報警信息web
Prometheus AlertManager
配置以下,alerting
與 global
同級# Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: - localhost:9093
rules
配置文件加入到Prometheus
配置文件中rule_files: - "/usr/local/prometheus/rules.yml"
rule.yml
文件groups: - name: prometheus_go_goroutines rules: - alert: go_goroutines_numbers expr: go_goroutines > 45 for: 15s annotations: summary: "prometheus的gorotine數據超過40!"
alertmanager
配置文件,加入微信配置信息global: resolve_timeout: 2m wechat_api_url: 'https://qyapi.weixin.qq.com/cgi-bin/' wechat_api_secret: 'xxx' wechat_api_corp_id: 'xxx' route: group_by: ['alertname'] group_wait: 10s group_interval: 10s repeat_interval: 1h receiver: 'wechat' receivers: - name: 'wechat' wechat_configs: - send_resolved: true to_party: '1' agent_id: '1000002'
wechat_api_url
: wechat
對外接口https://qyapi.weixin.qq.com/cgi-bin/
wechat_api_secret
: 企業微信("企業應用"-->"自定應用"[Prometheus
]--> "Secret") Prometheus
是本人自建立應用名稱wechat_api_corp_id
: 企業信息("個人企業"--->"CorpID"[在底部])to_party
: 1
值是組的ID
你可經過連接去定製報警信息接收人或者組(https://work.weixin.qq.com/ap...agent_id
: 企業微信("企業應用"-->"自定應用"[Prometheus
]--> "AgentId") Prometheus
是本人自建立應用名稱
本人QQ: 375419830c#