最近更新时间:2024.04.19 11:53:53
首次发布时间:2023.06.30 15:23:34
获取 RecordingRule 规则列表。
参数名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | ListRules | 公共参数,本接口值:ListRules。 |
Version | String | 是 | 2021-03-03 | 公共参数,本接口值:2021-03-03。 |
PageNumber | Integer | 否 | 1 | 当前页数,最小值或默认值均为 1。 |
PageSize | Integer | 否 | 10 | 单页数量:
|
Filter | Object RuleFilter | 是 | - | 规则过滤条件。 |
参数名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
WorkspaceId | String | 是 | e28ae750-bbb8-4ff4-abf4-1e0e0f88808c | 按工作区 ID 过滤,精确查询。 |
Kind | String | 是 | Recording | 按规则类型过滤,固定取值为Recording 。 |
Name | String | 否 | test | 按规则名称过滤,模糊查询。 |
RuleFileNames | Array of String | 否 | ["test"] | 按规则文件名称过滤,模糊查询。 |
RuleGroupNames | Array of String | 否 | ["test"] | 按规则组名称过滤,模糊查询。 |
Status | Array of String | 否 | ["Running"] | 按规则状态过滤,精确查询。取值:
|
POST /?Action=ListRules&Version=2021-03-03 Content-Type:application/json { "PageNumber": 1, "PageSize": 10, "Filter": { "WorkspaceId": " e28ae750-bbb8-4ff4-abf4-1e0e0f88808c", "Kind": "Recording", "Name": "test", "RuleFileNames": ["test"], "RuleGroupNames": ["test"], "Status": ["Running"] } }
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Total | Integer | 100 | 规则总数。 |
Items | Array of Rule | - | 规则列表。 |
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Name | String | my_first_recording_rule | 规则名称,支持模糊搜索。 |
RuleFileName | String | test | 所属规则文件名称。 |
RuleGroupName | String | test | 所属规则组名称。 |
Kind | String | Recording | 规则类型,固定值为Recording 。 |
Expr | String | sum(rate(container_cpu_usage_seconds_total[5m])) by (pod) | 规则中的 PromQL 表达式。 |
Labels | Array of LabelKeyValuePair | 在存储指标之前添加或覆盖的标签。 | |
Status | String | Running | 规则文件状态:
|
LastEvaluation | String | 2022-01-01T00:00:00Z | 最后执行时间,RFC3339 格式。 |
Reason | String | internal error | 状态转为错误时的原因。 |
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Key | String | team | 键 |
Value | String | operations | 值 |
HTTP/1.1 200 OK Content-Type:application/json { "ResponseMetadata": { "RequestId": "202211302208xxxx", "Action": "ListRules", "Version": "2021-03-03", "Service": "vmp", "Region": "cn-beijing" }, "Result": { "Total": 100, "Items": [ { "Name": "my_first_recording_rule", "RuleFileName": "test", "RuleGroupName": "test", "Kind": "Recording", "Expr": "sum(rate(container_cpu_usage_seconds_total[5m])) by (pod)", "Labels": [ { "Key": " team", "Value": " operations" } ], "Status": "Running", "LastEvaluation": "2022-01-01T00:00:00Z", "Reason": "internal error" } ] } }
本接口错误码如下表所示,公共错误码请参见 公共错误码。
HTTP 状态码 | 错误码 | 错误信息 | 描述 |
---|---|---|---|
404 | NotFound.Id | The specified Workspace {{id}} is not found. | 未找到指定的工作区。 |