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

查询 RecordingRule 规则文件详情。

请求说明

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

请求参数

说明

IdWorkspaceId + Name 不能同时配置,但至少需要选择一种:

  • 可以通过 Id 直接指定需要查询的规则文件。
  • 可以通过 WorkspaceId + Name 在工作区内,通过名称指定需要查询的规则文件。
参数类型是否必选示例值描述
ActionStringGetRuleFile接口名称。当前 API 的名称为 GetRuleFile
VersionString2021-03-03接口版本。当前 API 的版本为 2021-03-03
IdString1c3f6e48-b5e1-4832-8564-10eaac12a22c规则文件 ID。
WorkspaceIdStringe28ae750-bbb8-4ff4-abf4-1e0e0f88808c工作区 ID,必须和Name同时配置。
NameStringtest规则文件名称,必须和WorkspaceId同时配置。

请求示例

POST https://open.volcengineapi.com/?Action=GetRuleFile&Version=2021-03-03
Content-Type: application/json
{
    "Id": "1c3f6e48-b5e1-4832-8564-10eaac12a22c",
    "WorkspaceId": "e28ae750-bbb8-4ff4-abf4-1e0e0f88808c",
    "Name": "test"
}

返回参数

参数类型示例值描述
IdStringe28ae750-bbb8-4ff4-abf4-1e0e0f88808c规则文件 ID。
CreateTimeString2022-01-01T00:00:00Z规则文件创建时间,RFC3339 格式。
LastUpdateTimeString2022-01-01T00:00:00Z规则文件最近更新时间,RFC3339 格式。
NameStringtest规则文件名称。
DescriptionString这是一段描述规则文件描述信息。

Content

String

groups:
- name: example
  rules:
    - record: test
      expr: up

规则文件内容。

Status

String

Running

规则文件状态:

  • Creating:创建中
  • Running:运行中
  • Updating:更新中
  • OverdueShutted:欠费关停
  • Resuming:恢复中
RuleCountLong2规则文件中的规则数。

返回示例

HTTP/1.1: 200 OK
Content-Type: application/json
{
    "ResponseMetadata": {
        "RequestId": "202211302208xxxx",
        "Action": "GetRuleFile",
        "Version": "2021-03-03",
        "Service": "vmp",
        "Region": "cn-beijing"
    },
    "Result": {
        "Id": " 1c3f6e48-b5e1-4832-8564-10eaac12a22c",
        "CreateTime": "2022-01-01T00:00:00Z",
        "LastUpdateTime": "2022-01-01T00:00:00Z",
        "Name": "test",
        "Description": "这是一段描述",
        "content": "groups:\n- name: example\n  rules:\n  - expr: up\n    record: test\n",
        "Status": "Running",
        "RuleCount": 2
    }
}

错误码

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

HTTP 状态码错误码错误信息说明
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 的工作区。
400InvalidParameter.{{parameter}}The specified parameter {{parameter}} is invalid.输入不合法,如工作区名称不合法等。
400MissingParameter.{{parameter}}The required parameter {{parameter}} is missing.缺少必要的参数。