告警事件相关接口
更新时间:2026-06-01
查询 CProm 告警事件列表
接口描述
根据查询条件分页获取告警事件列表。支持按时间范围、监控实例、告警规则、告警等级、事件状态等多种条件过滤,并支持分页和排序。接口使用 BCE V1 签名鉴权,通过 Authorization 头传递签名串。
请求结构
Plain Text
1GET /v2/event?startTime={startTime}&endTime={endTime}&pageNo={pageNo}&pageSize={pageSize}&monitorInstanceId={monitorInstanceId}&alertingRuleId={alertingRuleId}&alertingRuleName={alertingRuleName}¬ifyRuleId={notifyRuleId}¬ifyRuleName={notifyRuleName}&severity={severity}&status={status}&orderBy={orderBy}&order={order}&alarmTags[key]={value} HTTP/1.1
2Host: cprom.bj.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| startTime | Integer | 否 | Query 参数 | 查询开始时间(Unix 时间戳,秒),默认为最近 1 天 |
| endTime | Integer | 否 | Query 参数 | 查询结束时间(Unix 时间戳,秒),默认为当前时间 |
| pageNo | Integer | 否 | Query 参数 | 分页查询页码数,从 1 开始,缺省值为 1 |
| pageSize | Integer | 否 | Query 参数 | 每页数量,范围为 1-100,缺省值为 10 |
| monitorInstanceId | String | 否 | Query 参数 | 监控实例 ID |
| alertingRuleId | String | 否 | Query 参数 | 告警规则 ID |
| alertingRuleName | String | 否 | Query 参数 | 告警规则名称(支持模糊匹配) |
| notifyRuleId | String | 否 | Query 参数 | 通知规则 ID |
| notifyRuleName | String | 否 | Query 参数 | 通知规则名称 |
| severity | String | 否 | Query 参数 | 告警等级,可选值:critical(严重)、warning(警告)、info(信息) |
| status | String | 否 | Query 参数 | 事件状态,可选值:abnormal(异常)、normal(正常)、level1-4(升级级别) |
| expr | String | 否 | Query 参数 | 告警表达式 |
| orderBy | String | 否 | Query 参数 | 排序字段,可选值:startTime、endTime、alarmValue、severity,缺省值为 startTime |
| order | String | 否 | Query 参数 | 排序顺序,取值:asc(升序)、desc(降序),缺省值为 desc |
| alarmTags | String | 否 | Query 参数 | 告警标签过滤条件,支持多个标签 |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| totalCount | Integer | 告警事件总个数 |
| pageNo | Integer | 当前页码数 |
| pageSize | Integer | 当前页告警事件个数 |
| items | List< Event > | 告警事件列表 |
| orderBy | String | 排序依据字段 |
| order | String | 排序方式:desc 倒序,asc 升序 |
Event(告警事件)
| 参数名称 | 类型 | 描述 |
|---|---|---|
| eventId | String | 事件 ID |
| monitorInstanceId | String | 监控实例 ID |
| alertingRuleId | String | 告警规则 ID |
| alertingRuleName | String | 告警规则名称 |
| notifyRuleId | String | 通知规则 ID |
| notifyRuleName | String | 通知规则名称 |
| severity | String | 告警等级:critical/warning/info |
| status | String | 事件状态:abnormal/normal/level1-4 |
| startTime | Integer | 事件开始时间(Unix 时间戳,秒) |
| endTime | Integer | 事件结束时间(Unix 时间戳,秒),0 表示未结束 |
| duration | Integer | 事件持续时间(秒) |
| alarmValue | String | 告警值 |
| expr | String | 告警表达式 |
| description | String | 告警描述 |
| alarmTags | Object | 告警标签 |
| labels | Object | 告警规则标签 |
| annotations | Object | 告警规则注解 |
| claimedInfo | ClaimedInfo | 认领信息 |
ClaimedInfo(认领信息)
| 参数名称 | 类型 | 描述 |
|---|---|---|
| isClaimed | Boolean | 是否认领 |
| userName | String | 认领人用户名 |
| claimTime | Integer | 认领时间(Unix 时间戳,秒) |
| claimReason | String | 认领原因 |
请求示例
Plain Text
1GET /v2/event?startTime=1779349840&endTime=1779436240&pageNo=1&pageSize=10&alertingRuleName=cpu_usage&severity=warning&status=abnormal&orderBy=startTime&order=desc&alarmTags[region]=bjtest3 HTTP/1.1
2Host: cprom.bj.baidubce.com
3Content-Type: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2025-05-27T08:23:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
响应示例
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: 27 May 2025 08:23:30 GMT
4Content-Type: application/json;charset=UTF-8
5
6{
7 "totalCount": 2,
8 "pageNo": 1,
9 "pageSize": 10,
10 "items": [
11 {
12 "eventId": "00576526010e259eb0522",
13 "monitorInstanceId": "cprom-pvs5wi3i4mrg7",
14 "alertingRuleId": "alerting-706syo3w7",
15 "alertingRuleName": "cprom_vm_disk_space_greater_than_80_percent",
16 "notifyRuleId": "",
17 "notifyRuleName": "",
18 "severity": "warning",
19 "status": "normal",
20 "startTime": 1779422413,
21 "endTime": 1779422475,
22 "duration": 62,
23 "alarmValue": "0.8032811408141922",
24 "expr": "sum(vm_data_size_bytes{}) by(region, app_kubernetes_io_instance, pod_name) / (sum(vm_free_disk_space_bytes{}) by(region, app_kubernetes_io_instance, pod_name) + sum(vm_data_size_bytes{}) by(region, app_kubernetes_io_instance, pod_name)) > 0.8",
25 "description": "region: bjtest3, instance: cprom-qr6i6ma534p7b pod_name: vmstorage-cprom-qr6i6ma534p7b-2 cprom_vm_disk_space",
26 "alarmTags": {
27 "app_kubernetes_io_instance": "cprom-qr6i6ma534p7b",
28 "pod_name": "vmstorage-cprom-qr6i6ma534p7b-2",
29 "region": "bjtest3"
30 },
31 "labels": {},
32 "annotations": {},
33 "claimedInfo": {
34 "isClaimed": false,
35 "userName": "",
36 "claimTime": 0
37 }
38 }
39 ],
40 "orderBy": "startTime",
41 "order": "desc"
42}
查询 CProm 告警事件详情
接口描述
根据事件 ID 查询告警事件的详细信息。接口使用 BCE V1 签名鉴权,通过 Authorization 头传递签名串。
请求结构
Plain Text
1GET /v2/event/{eventId} HTTP/1.1
2Host: cprom.bj.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| eventId | String | 是 | Path 参数 | 告警事件 ID |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| eventId | String | 事件 ID |
| monitorInstanceId | String | 监控实例 ID |
| alertingRuleId | String | 告警规则 ID |
| alertingRuleName | String | 告警规则名称 |
| notifyRuleId | String | 通知规则 ID |
| notifyRuleName | String | 通知规则名称 |
| severity | String | 告警等级:critical/warning/info |
| status | String | 事件状态:abnormal/normal/level1-4 |
| startTime | Integer | 事件开始时间(Unix 时间戳,秒) |
| endTime | Integer | 事件结束时间(Unix 时间戳,秒),0 表示未结束 |
| duration | Integer | 事件持续时间(秒) |
| alarmValue | String | 告警值 |
| expr | String | 告警表达式 |
| description | String | 告警描述 |
| alarmTags | Object | 告警标签 |
| labels | Object | 告警规则标签 |
| annotations | Object | 告警规则注解 |
| claimedInfo | ClaimedInfo | 认领信息 |
ClaimedInfo(认领信息)
| 参数名称 | 类型 | 描述 |
|---|---|---|
| isClaimed | Boolean | 是否认领 |
| userName | String | 认领人用户名 |
| claimTime | Integer | 认领时间(Unix 时间戳,秒) |
| claimReason | String | 认领原因 |
请求示例
Plain Text
1GET /v2/event/00576526010e259eb0522 HTTP/1.1
2Host: cprom.bj.baidubce.com
3Content-Type: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2025-05-27T08:23:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
响应示例
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: 27 May 2025 08:23:30 GMT
4Content-Type: application/json;charset=UTF-8
5
6{
7 "eventId": "00576526010e259eb0522",
8 "monitorInstanceId": "cprom-pvs5wi3i4mrg7",
9 "alertingRuleId": "alerting-706syo3w7",
10 "alertingRuleName": "cprom_vm_disk_space_greater_than_80_percent",
11 "notifyRuleId": "",
12 "notifyRuleName": "",
13 "severity": "warning",
14 "status": "normal",
15 "startTime": 1779422413,
16 "endTime": 1779422475,
17 "duration": 62,
18 "alarmValue": "0.8032811408141922",
19 "expr": "sum(vm_data_size_bytes{}) by(region, app_kubernetes_io_instance, pod_name) / (sum(vm_free_disk_space_bytes{}) by(region, app_kubernetes_io_instance, pod_name) + sum(vm_data_size_bytes{}) by(region, app_kubernetes_io_instance, pod_name)) > 0.8",
20 "description": "region: bjtest3, instance: cprom-qr6i6ma534p7b pod_name: vmstorage-cprom-qr6i6ma534p7b-2 cprom_vm_disk_space",
21 "alarmTags": {
22 "app_kubernetes_io_instance": "cprom-qr6i6ma534p7b",
23 "pod_name": "vmstorage-cprom-qr6i6ma534p7b-2",
24 "region": "bjtest3"
25 },
26 "labels": {},
27 "annotations": {},
28 "claimedInfo": {
29 "isClaimed": false,
30 "userName": "",
31 "claimTime": 0
32 }
33}
认领 CProm 告警事件
接口描述
认领一个或多个告警事件。认领后,事件将被标记为已认领状态,并记录认领人和认领时间。接口使用 BCE V1 签名鉴权,通过 Authorization 头传递签名串。
请求结构
Plain Text
1POST /v2/event/claim HTTP/1.1
2Host: cprom.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "eventIds": ["eventId1", "eventId2"],
7 "claimReason": "claimReason"
8}
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| eventIds | Array | 是 | Body 参数 | 要认领的事件 ID 列表(1-100 个) |
| claimReason | String | 否 | Body 参数 | 认领原因(最大 500 字符) |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| successCount | Integer | 成功认领数量 |
| failedCount | Integer | 失败认领数量 |
| details | List< EventClaimDetail > | 认领详情 |
EventClaimDetail(认领详情)
| 参数名称 | 类型 | 描述 |
|---|---|---|
| eventId | String | 事件 ID |
| success | Boolean | 是否成功 |
| message | String | 错误信息(失败时有值) |
请求示例
Plain Text
1POST /v2/event/claim HTTP/1.1
2Host: cprom.bj.baidubce.com
3Content-Type: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2025-05-27T08:23:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
5
6{
7 "eventIds": [
8 "00576526010e259eb0522",
9 "00106525f536afe4c0522"
10 ],
11 "claimReason": "正在处理中"
12}
响应示例
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: 27 May 2025 08:23:34 GMT
4Content-Type: application/json;charset=UTF-8
5
6{
7 "successCount": 2,
8 "failedCount": 0,
9 "details": [
10 {
11 "eventId": "00576526010e259eb0522",
12 "success": true,
13 "message": ""
14 },
15 {
16 "eventId": "00106525f536afe4c0522",
17 "success": true,
18 "message": ""
19 }
20 ]
21}
部分成功响应示例
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: 27 May 2025 08:23:34 GMT
4Content-Type: application/json;charset=UTF-8
5
6{
7 "successCount": 1,
8 "failedCount": 1,
9 "details": [
10 {
11 "eventId": "00576526010e259eb0522",
12 "success": true,
13 "message": ""
14 },
15 {
16 "eventId": "invalid-event-id",
17 "success": false,
18 "message": "event not found"
19 }
20 ]
21}
评价此篇文章
