最近更新时间:2024.04.19 11:53:55
首次发布时间:2023.06.30 15:23:34
获取告警列表。
参数名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | ListAlerts | 公共参数,本接口值:ListAlerts。 |
Version | String | 是 | 2021-03-03 | 公共参数,本接口值:2021-03-03。 |
Limit | Integer | 否 | 10 | 告警单页数量:
|
SearchAfter | String | 否 | ********* | 翻页 token。 |
Filter | Object AlertFilter | 否 | - | 告警过滤条件。 |
OrderBy | String | 否 | InitialAlertTimestamp | 告警排序键,固定取值为InitialAlertTimestamp 。 |
Desc | Boolean | 否 | true | 是否采用降序排序,取值:
|
参数名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Ids | Array of String | 否 | ["173ee193-0aa6-4dd9-9074-9808c0f758cd"] | 按告警 ID 过滤,精确查询。 |
CurrentPhase | String | 否 | Active | 按告警当前所处状态过滤,精确查询:
|
Level | String | 否 | P0 | 按告警等级过滤,精确查询。包括:P0、P1 和 P2。 |
AlertingRuleIds | Array of String | 否 | ["90b5a3da-3464-4718-92e4-039bf41d3cff"] | 按告警规则 ID 过滤,精确查询。 |
POST /?Action=ListAlerts&Version=2021-03-03 Content-Type:application/json { "Limit": 10, "SearchAfter": "*********", "Filter": { "Ids": ["173ee193-0aa6-4dd9-9074-9808c0f758cd"], "CurrentPhase": "Active", "Level": "P0", "AlertingRuleIds": ["90b5a3da-3464-4718-92e4-039bf41d3cff"] }, "OrderBy": "InitialAlertTimestamp", "Desc": true }
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Total | Integer | 100 | 告警总数。 |
ContinueToken | String | ******* | 用来分段 List 对象时填入的翻页 token。 |
Items | Array of Alert | - | 告警列表。 |
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Id | string | 173ee193-0aa6-4dd9-9074-9808c0f758cd | 告警事件 ID。 |
AlertingRuleId | string | 90b5a3da-3464-4718-92e4-039bf41d3cff | 告警规则 ID。 |
Levels | object AlertingRuleLevel | - | 告警等级类别。 |
InitialAlertTimestamp | string | 2020-05-20T13:00:55Z | 告警开始时间,RFC3339 格式。 |
LastAlertTimestamp | string | 2020-05-20T13:00:55Z | 告警最近触发时间,RFC3339 格式。 |
ResolveTimestamp | string | 2020-05-20T13:00:55Z | 告警结束时间,RFC3339 格式。 |
CurrentPhase | string | Active | 告警状态:
|
CurrentLevel | string | - | 告警事件等级,包括:P0、P1 和 P2。 |
AlertingRuleType | string | vmp/PromQL | 告警规则类型,固定值为vmp/PromQL 。 |
AlertingRuleQuery | object AlertingRuleQuery | - | 告警配置。 |
Resource | object AlertResource | - | 告警资源。 |
参数名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Level | String | 是 | P0 | 告警规则等级,包括:P0、P1 和 P2。 |
For | String | 否 | 5m | 告警持续时间,取值:
|
Comparator | String | 是 | > | 告警规则比较条件,取值:
|
Threshold | Float64 | 是 | 1.0 | 告警规则阈值。 |
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
WorkspaceId | String | e28ae750-bbb8-4ff4-abf4-1e0e0f88808c | 工作区 ID。 |
PromQL | String | sum(up) | 查询语句。 |
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Labels | list LabelKeyValuePair | - |
|
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Key | String | key | 键 |
Value | String | value | 值 |
HTTP/1.1 200 OK Content-Type:application/json { "ResponseMetadata": { "RequestId": "202211302208xxxx", "Action": "ListAlerts", "Version": "2021-03-03", "Service": "vmp", "Region": "cn-beijing" }, "Result": { "Total": 100, "ContinueToken": "*******", "Items": [ { "Id": "173ee193-0aa6-4dd9-9074-9808c0f758cd", "AlertingRuleId": "90b5a3da-3464-4718-92e4-039bf41d3cff", "Levels": [ { "Level": " P0", "For": " 5m", "Comparator": " >", "Threshold": } ], "InitialAlertTimestamp": "2020-01-01T00:00:00Z", "LastAlertTimestamp": "2020-01-01T00:00:00Z", "ResolveTimestamp": "2020-01-01T00:00:00Z", "CurrentPhase": "Active", "CurrentLevel": "P0", "AlertingRuleType": "vmp/PromQL", "AlertingRuleQuery": { "WorkspaceId": " e28ae750-bbb8-4ff4-abf4-1e0e0f88808c", "PromQL": " sum(up)" }, "Resource": { "Label": [ { "Key": " key", "Value": " value" } ], } } ] } }
本接口错误码如下表所示,公共错误码请参见 公共错误码。
HTTP 状态码 | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InvalidParameter.{{parameter}} | The specified {{parameter}} is invalid. | 参数不合法,请检查参数正确性后重试。 |
403 | ProductUnsubscribed | You are not subscribed to the Volcengine Managed Service for Prometheus (VMP). Please go to the VMP console web page to subscribe to the service | 当前账号未订阅 VMP 服务。 |