You need to enable JavaScript to run this app.
导航
ListRuleFiles
最近更新时间:2025.05.22 15:52:58首次发布时间:2023.06.30 15:23:33
我的收藏
有用
有用
无用
无用

获取 RecordingRule 规则文件列表。

请求说明

  • 请求方式:POST
  • 请求地址:https://open.volcengineapi.com/?Action=ListRuleFiles&Version=2021-03-03

请求参数

参数类型是否必选示例值描述
ActionStringListRuleFiles接口名称。当前 API 的名称为 ListRuleFiles
VersionString2021-03-03接口版本。当前 API 的版本为 2021-03-03
PageNumberLong1当前页数,最小值或默认值均为 1。

PageSize

Long

10

单页数量:

  • 取值范围为 0~100。
  • 默认值为 10。
FilterObject of RuleFileFilter-规则文件过滤条件。

RuleFileFilter

参数类型是否必选示例值描述
IdsArray of String["e28ae750-bbb8-4ff4-abf4-1e0e0f88808c"]按规则文件 id 过滤,精确查询
NameStringtest按规则文件名称过滤,模糊搜索
StatusArray of String["Running"]按规则文件状态过滤,精确查询
WorkspaceIdStringe28ae750-bbb8-4ff4-abf4-1e0e0f88808c按工作区 id 过滤,精确查询

请求示例

POST https://open.volcengineapi.com/?Action=ListRuleFiles&Version=2021-03-03
Content-Type: application/json
{
    "PageNumber": 1,
    "PageSize": 10,
    "Filter": {
        "Ids": [
            "e28ae750-bbb8-4ff4-abf4-1e0e0f88808c"
        ],
        "Name": "test",
        "Status": [
            "Running"
        ],
        "WorkspaceId": "e28ae750-bbb8-4ff4-abf4-1e0e0f88808c"
    }
}

返回参数

参数类型示例值描述
TotalLong100规则文件总数。
ItemsArray of RuleFile-规则文件列表。

RuleFile

参数类型示例值描述
IdStringe28ae750-bbb8-4ff4-abf4-1e0e0f88808c规则文件 id

Name

String

test

规则文件名称:
- Linux合法文件名,且长度小于 255
- 工作区内唯一

Status

String

Running

规则文件状态,可选值:
- Creating(创建中)
- Running(运行中)
- Updating(更新中)
- OverdueShutted(欠费关停)
- Resuming(恢复中)

Content

String

{"groups": [{"name": "my_first_recording_rule", "rules": [{"expr": "up", "record": "up"}], "interval": "30s"}]}

规则文件内容:
- 数据 yaml格式
- 支持长度
- 单个 expr 长度不能超过 16 KB
- 单个 record 不能超过 2,048 Bytes
- 单个 labelname 不能超过 256 Bytes
- 单个 labelvalue 不能超过 2,048 Bytes

RuleCountLong2规则文件中规则数
CreateTimeString2022-01-01T00:00:00Z规则文件创建时间

Description

String

这是一段描述

规则文件描述信息:
- 支持0-200个字符长度(一个英文、一个中文、一个符号都为一个字符)
- 支持用户修改

LastUpdateTimeString2022-01-01T00:00:00Z规则文件最近更新时间

返回示例

HTTP/1.1: 200 OK
Content-Type: application/json
{
    "ResponseMetadata": {
        "RequestId": "20230604110420****100232280022D31",
        "Action": "ListRuleFiles",
        "Version": "2021-03-03",
        "Service": "vmp",
        "Region": "cn-north-1"
    },
    "Result": {
        "Total": 100,
        "Items": [
            {
                "Id": "e28ae750-bbb8-4ff4-abf4-1e0e0f88808c",
                "Name": "test",
                "Status": "Running",
                "RuleCount": 2,
                "CreateTime": "2022-01-01T00:00:00Z",
                "Description": "这是一段描述",
                "LastUpdateTime": "2022-01-01T00:00:00Z"
            }
        ]
    }
}

错误码

本接口错误码如下表所示,公共错误码请参见 公共错误码

HTTP 状态码错误码错误信息说明
400InvalidParameter.{{parameter}}The specified parameter {{parameter}} is invalid.输入不合法,如工作区名称不合法等。
400MissingParameter.{{parameter}}The required parameter {{parameter}} is missing.缺少必要的参数。
403ProductUnsubscribedYou 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 服务。
404NotFound.WorkspaceThe specified Workspace {{id}} is not found.未找到相应 id 的工作区。