Grafana + pushplus:监控告警推到微信
效果:Grafana Alerting 触发后,通过 Webhook 调用 pushplus。
前置条件
- 一个 pushplus token(官网扫码获取)
- Grafana 8+(统一 Alerting)管理权限
配置步骤
- Grafana → Alerting → Contact points → 新增 Contact point。
- 类型选 Webhook。
- 推荐用固定文案 URL(Grafana 默认 POST 的告警 JSON 不会被当成
content):
https://www.pushplus.plus/send?token=你的token&title=Grafana告警&content=请打开Grafana查看告警详情
- 若你的 Grafana 支持自定义 payload(或用 webhook 中间层),POST JSON:
{
"token": "你的token",
"title": "Grafana 告警",
"content": "{{ .CommonLabels.alertname }} {{ .Status }}",
"template": "markdown"
}
模板语法以 Grafana 版本为准。
- 在 Notification policy 里把告警路由到该 Contact point,点 Test。
需要完整告警 JSON 正文时,可用会员 预处理 解析,或自建一个很小的中转,把 Grafana payload 转成 title / content 再调 /send。
验证
curl -X POST "https://www.pushplus.plus/send" \
-H "Content-Type: application/json" \
-d '{"token":"你的token","title":"Grafana 配置测试","content":"token 可用","template":"markdown"}'
常见问题
测试成功但正文是固定那句? 直连 GET 就是固定文案。动态字段必须自定义 payload 或中转。
告警风暴? 在 Grafana 里设分组、pending 时间和静默。