You need to enable JavaScript to run this app.
导航

ListEventRules

最近更新时间2024.03.12 16:52:17

首次发布时间2022.10.26 11:08:02

调用ListEventRules接口查询事件规则的信息。

注意事项

该接口调用服务方较多,不建议高频调用,否则将触发限流。建议QPS值不大于20。

Request URL

POST https://open.volcengineapi.com?Action=ListEventRules&Version=2018-01-01

ServiceName : Volc_Observe
Region : cn-beijing 
AccessKey : xxx
SecretKey : xxx

请求参数

参数

类型

是否必填

示例值

说明

RuleName

String

rule-01

规则名称,按照名称模糊搜索规则。

Source

String

ecs

事件源。

Status

String

enable

规则状态。

  • enable:启用规则
  • disable:禁用规则

PageSize

Integer

30

分页查询参数,用于设置每页行数。默认值:30。

PageNumber

Integer

1

分页查询参数,用于设置当前页码。默认值:1。

OrderBy

String

UpdatedAt

规则排列依据。

  • UpdatedAt(默认):按照规则的修改时间排列
  • RuleName:按照规则名称排序
  • CreatedAt:按照规则创建事件排列

Asc

Boolean

false

规则排序方式。

  • true:升序
  • false:降序

返回参数

参数

类型

示例值

说明

Data

Array

-

符合条件的规则的详细信息。具体格式,请参见Data数据结构

PageSize

Integer

30

当前分页的行数。

PageNumber

Integer

1

当前页码。

OrderBy

String

HappenTime

返回规则的排序依据。

Asc

Boolean

false

返回规则的排序方式。

TotalCount

Integer

10

符合条件的事件规则总数。

Data数据结构

参数

类型

示例值

说明

RuleId

String

168*****4352

事件规则ID。

Source

String

vke

事件源。

RuleName

String

test-kafka

规则名称。

Description

String

This is test rule 01

规则描述。

EventBusName

String

default

事件总线名称,目前仅支持填写default。

AccountId

String

210****168

主账号ID。

Region

String

cn-chengdu-sdv

地域。

Level

String

critical

告警规则的严重程度。

EnableState

String

enable

规则状态。

  • enable:规则启用
  • disable:规则禁用

EffectStartAt

String

12:00

规则启用的开始时间。

EffectEndAt

String

20:00

规则启用的结束时间。

EventType

Array

["vke:Addon:AddonStatus.Failed"]

事件类型。

FilterPattern

Object

-

过滤模式,也叫事件匹配规则。具体格式,请参见FilterPattern数据结构
暂时不支持自定义匹配规则。

ContactMethods

Array

[ "Webhook",
"Email",
"MQ",
"SMS" ]

告警通知方式。

  • Phone:电话
  • Email:邮件
  • SMS:短信
  • Webhook:告警回调
  • TLS:日志服务
  • MQ:消息队列kafka

Endpoint

String

http://example.com/alert

告警通知方式为告警回调时,触发的回调地址。

TLSTarget

Array

[{"RegionNameEN": "cn-guilin-boe",
"RegionNameCN": "桑园",
"ProjectId": "79fe****122f",
"ProjectName": "test",
"TopicId": "6a6****67c7"}]

告警方式为日志服务时,触发的日志服务的配置。

ContactGroupIds

Array

["166*****7680"]

告警通知方式为电话、短信、邮件时,触发的告警联系组ID。

MessageQueue

Array

[{"Type": "kafka",
"Region": "cn-guilin-boe",
"InstanceId": "kafka-cno*****5hc",
"Topic": "testkafka",
"VpcId": "vpc-2bzq*****pm22"}]

告警通知方式为消息队列kafka时,触发的消息队列。

UpdatedAt

Interger

1666686791

事件规则更新时间。

CreatedAt

Interger

1666668613

事件规则创建时间。

FilterPattern数据结构

参数

类型

示例值

说明

Type

Array

["vke:Addon:AddonStatus.Failed"]

模式匹配中对应的事件类型列表,当前为任意匹配。

Source

String

vke

模式匹配中对应的事件源。

请求示例

POST https://open.volcengineapi.com/?Action=ListEventRules&Version=2018-01-01
ServiceName=Volc_Observe
Region=cn-beijing 
AccessKey=xxx 
SecretKey=xxx 

{
    "RuleName": "rule-01",
    "OrderBy": "UpdatedAt",
    "Asc": true,
    "PageSize": 10,
    "PageNumber": 1
}

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2b02*****f3b3",
        "Action": "ListEventRules",
        "Version": "2018-01-01"
        "Region": "cn-chengdu-sdv"
    },
    "Result": {
        "Data": [
            {
                "RuleId": "168*****4352",
                "Source": "vke",
                "RuleName": "test-kafka",
                "Description":"This is test rule 01",
                "EventBusName": "default",
                "AccountId": "210****168",
                "Region": "cn-chengdu-sdv",
                "Level": "critical",
                "EnableState": "enable",
                "EffectStartAt": "00:00",
                "EffectEndAt": "23:59",
                "EventType": [
                    "vke:Addon:AddonStatus.Failed"
                ],
                "FilterPattern": {
                    "Source": "vke",
                    "Type": [
                        "vke:Addon:AddonStatus.Failed"
                    ]
                },
                "ContactMethods": [
                    "MQ",
                    "Webhook",
                    "Email",
                    "SMS"
                ],
                "ContactGroupIds": [
                    "166*****7680"
                ],
                "Endpoint":"http://example.com/alert",
                "MessageQueue": [
                    {
                        "Type": "kafka",
                        "Region": "cn-guilin-boe",
                        "InstanceId": "kafka-cno*****5hc",
                        "Topic": "testkafka",
                        "VpcId": "vpc-2bzq*****pm22"
                    }
                ],
                "UpdatedAt": 1691474146,
                "CreatedAt": 1691474146
            }
        ],
        "PageNumber": 1,
        "PageSize": 10,
        "TotalCount": 1,
        "OrderBy": "UpdatedAt",
        "Asc": true
    }
}