OnCall 告警系统

飞书告警与排班管理

仅消息模式
当前时间

11:15:13

今日值班

暂无排班

排班人员

暂无人员

加急时段

工作日 00:00-00:00

节假日全天

快速测试
排班日历
20267
周日
周一
周二
周三
周四
周五
周六
1
全天加急
2
全天加急
3
全天加急
4
全天加急
5
全天加急
6
全天加急
7
全天加急
8
今天
全天加急
9
全天加急
10
全天加急
11
全天加急
12
全天加急
13
全天加急
14
全天加急
15
全天加急
16
全天加急
17
全天加急
18
全天加急
19
全天加急
20
全天加急
21
全天加急
22
全天加急
23
全天加急
24
全天加急
25
全天加急
26
全天加急
27
全天加急
28
全天加急
29
全天加急
30
全天加急
31
全天加急
API 接口
POST/api/alert?content=...&mode=auto
# Query Params:
content=告警内容
mode=auto
POST/api/schedule
{
  "date": "2024-12-05",
  "userIds": ["ou_xxx"]
}
告警记录

暂无告警记录

API 接口
POST/api/alert发送告警

Grafana(推荐):

URL 示例(body 仍为 Grafana 默认 JSON):
/api/alert?chatId=oc_xxx&content=糟糕,好像有点问题发生,看看吧&urgentTypes=phone
content 飞书展示文案;urgentTypes=phone 触发轮播加急(含已读追踪)
body 中 alertname 按「时间规则」里的静默档位节流;resolved 不通知

Query 参数(手动 curl 时用):

content - 告警内容(Grafana 可不传,从 body 解析)
mode - 模式:auto | message_only | urgent_now | rotation
chatId - 自定义群聊 ID
userIds - 自定义加急用户 ID 列表(逗号分隔)
urgentTypes - 加急类型(逗号分隔):app,sms,phone

模式说明:

auto自动判断是否加急,触发完整轮播流程(默认)
message_only仅发送消息,不加急
urgent_now立即加急指定用户,忽略时间规则
rotation强制触发轮播加急

轮播流程:

第一轮:
1. 今日值班人员 → 逐个加急
2. 剩余排班人员 → 逐个加急
第二轮 ~ 第N轮:
全部排班人员 → 逐个加急
直到有人已读或达到最大轮播次数

curl 示例:

# 自动模式(推荐)
curl -X POST -G "http://localhost:3000/api/alert" \
  --data-urlencode "content=服务异常"

# 仅发送消息
curl -X POST -G "http://localhost:3000/api/alert" \
  --data-urlencode "content=测试消息" \
  -d "mode=message_only"

# 立即加急
curl -X POST -G "http://localhost:3000/api/alert" \
  --data-urlencode "content=紧急!" \
  -d "mode=urgent_now" \
  -d "urgentTypes=app,phone"

# 指定用户加急
curl -X POST -G "http://localhost:3000/api/alert" \
  --data-urlencode "content=告警" \
  -d "userIds=ou_xxx,ou_yyy"
GET/api/alert获取当前状态
curl http://localhost:3000/api/alert
GET/api/alerts获取告警记录
curl http://localhost:3000/api/alerts
GET/api/users获取用户列表
curl http://localhost:3000/api/users
GET/api/schedule获取排班列表
curl http://localhost:3000/api/schedule
GET/api/timerules获取时间规则
curl http://localhost:3000/api/timerules