# Elastic 接入 Server酱：Kibana 告警触发时推送到微信（2026 教程）

> 通过 Kibana Alerting 的 Webhook connector，将 Elastic 告警实时推送到微信。配置 POST 请求直连 Server酱 API，使用 mustache 模板拼接消息。

- 网页版：https://sct.ftqq.com/docs/integrations/elastic-kibana/
- 更新日期：2026-07-17

# Elastic + Server酱：Kibana 告警触发时推送到微信

> 效果：Elastic 告警规则触发时，自动将告警详情推送到微信

## 前置条件

- Server酱 SendKey（[30 秒获取教程](https://sct.ftqq.com/docs/getting-started/sendkey/)）
- Elastic 集群及 Kibana 管理权限

## 配置步骤

在 Kibana 中创建 Webhook connector 直连 Server酱 API。

1. **创建 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 后的数字）
- Header 新增：Key 为 `Content-Type`，Value 为 `application/x-www-form-urlencoded`
- Body：使用 mustache 语法将告警变量拼入 `title` 和 `desp` 参数

```text
title=【Elastic告警】&desp={{context.message}}
```

2. **绑定告警规则**

在 Rules 中创建或编辑告警规则，在 Action 区域选择刚创建的 Webhook connector，Kibana 会在告警触发时将渲染后的变量发送至 Server酱。Server酱 支持推送到微信服务号/企业微信/钉钉/飞书等多个通道，详见 /getting-started/channels/。

## 完整示例

以下为 Webhook connector 的完整 Body 配置示例，包含更详细的告警上下文：

```text
title=【Elastic告警】&desp=告警时间：见详情%0A%0A详情：{{context.message}}
```

注意：在 `application/x-www-form-urlencoded` 格式中，换行需使用 `%0A`，Kibana 会在发送时将其作为合法的 URL 编码处理。

## 常见问题

**免费额度是多少？**

每天 5 条，每分钟上限 50 条。订阅会员目前特价最低 3 元/月，一天最多可发 1000 条（[价格详情](https://sct.ftqq.com/subscribe)）。

**配置后消息没收到？**

检查 SendKey 是否正确，确认 Kibana Action 运行日志无报错，参考[常见问题与排查](https://sct.ftqq.com/docs/getting-started/faq/)。

**告警频率过高被限流怎么办？**

Server酱 API 每分钟上限 50 条，请在 Kibana Rule 的 Action 设置中调整告警频率或增加条件过滤，避免短时间大量触发。

## 相关集成

- [/integrations/python/](https://sct.ftqq.com/docs/integrations/python/) —— Python 脚本推送
- [/integrations/uptime-kuma/](https://sct.ftqq.com/docs/integrations/uptime-kuma/) —— Uptime Kuma 宕机告警
- [/integrations/qinglong/](https://sct.ftqq.com/docs/integrations/qinglong/) —— 青龙面板任务通知


## 懒人方案：把这段话复制给你的 AI 助手

把下面这段文字原样粘贴给 Claude Code、Cursor 或任何 AI 编程助手，它就会替你完成 Server酱 的接入：

```text
请帮我把 Server酱 微信通知接入到我当前的项目/工具中：
1. API：POST https://sctapi.ftqq.com/{SendKey}.send，参数 title（必填，不能含换行）、desp（正文，支持 Markdown，可选）；成功时返回 JSON 的 code 为 0。
2. 如果我的 SendKey 以 sctp 开头，则改用 https://{uid}.push.ft07.com/send/{SendKey}.send，uid 是 SendKey 中 sctp 与 t 之间的数字。
3. SendKey 从环境变量 SERVERCHAN_SENDKEY 读取；如果没有，提醒我到 https://sct.ftqq.com 免费获取（每天 5 条额度）。
4. 安全要求：不要把 SendKey 硬编码进代码、不要打印到日志、不要提交到 git。
5. 频率约定：任务结束发 1 条结果摘要即可，批量任务合并成一条，不要每步都推。
请根据我当前的项目和场景直接写好代码/配置并验证。
```

