Elastic + Server酱:Kibana 告警触发时推送到微信
效果:Elastic 告警规则触发时,自动将告警详情推送到微信
前置条件
- Server酱 SendKey(30 秒获取教程)
- Elastic 集群及 Kibana 管理权限
配置步骤
在 Kibana 中创建 Webhook connector 直连 Server酱 API。
- 创建 Connector
进入 Stack Management → Rules and Connectors,新建 Webhook connector,按以下配置填写:
- Method:
POST - URL:
https://sctapi.ftqq.com/你的SENDKEY.send- 若使用 Server酱³,URL 为
https://你的UID.push.ft07.com/send/你的SENDKEY.send(UID 取自 sctp 后的数字)
- 若使用 Server酱³,URL 为
- Header 新增:Key 为
Content-Type,Value 为application/x-www-form-urlencoded - Body:使用 mustache 语法将告警变量拼入
title和desp参数
title=【Elastic告警】&desp={{context.message}}
- 绑定告警规则
在 Rules 中创建或编辑告警规则,在 Action 区域选择刚创建的 Webhook connector,Kibana 会在告警触发时将渲染后的变量发送至 Server酱。Server酱 支持推送到微信服务号/企业微信/钉钉/飞书等多个通道,详见 /getting-started/channels/。
完整示例
以下为 Webhook connector 的完整 Body 配置示例,包含更详细的告警上下文:
title=【Elastic告警】&desp=告警时间:见详情%0A%0A详情:{{context.message}}
注意:在 application/x-www-form-urlencoded 格式中,换行需使用 %0A,Kibana 会在发送时将其作为合法的 URL 编码处理。
常见问题
免费额度是多少?
每天 5 条,每分钟上限 50 条。订阅会员目前特价最低 3 元/月,一天最多可发 1000 条(价格详情)。
配置后消息没收到?
检查 SendKey 是否正确,确认 Kibana Action 运行日志无报错,参考常见问题与排查。
告警频率过高被限流怎么办?
Server酱 API 每分钟上限 50 条,请在 Kibana Rule 的 Action 设置中调整告警频率或增加条件过滤,避免短时间大量触发。
相关集成
- /integrations/python/ —— Python 脚本推送
- /integrations/uptime-kuma/ —— Uptime Kuma 宕机告警
- /integrations/qinglong/ —— 青龙面板任务通知