You need to enable JavaScript to run this app.
导航
ListEventRules
最近更新时间:2024.06.27 14:36:24首次发布时间:2022.10.26 11:08:02

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

注意事项

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

请求说明

  • 请求方式:POST
  • 请求地址:https://open.volcengineapi.com?Action=ListEventRules&Version=2018-01-01
ServiceName : Volc_Observe
Region : cn-beijing 
AccessKey : xxx
SecretKey : xxx

调试

请求参数

Query

参数类型是否必选示例值描述
ActionStringListEventRules接口名称。当前 API 的名称为 ListEventRules
VersionString2018-01-01接口版本。当前 API 的版本为 2018-01-01

Body

参数类型是否必选示例值描述
RuleNameStringrule-01规则名称,按照名称模糊搜索规则。
SourceArray of Stringecs事件源。

Status

Array of String

enable

规则状态。

  • enable:启用规则
  • disable:禁用规则
PageSizeInteger30分页查询参数,用于设置每页行数。默认值:30。
PageNumberInteger1分页查询参数,用于设置当前页码。默认值:1。

OrderBy

String

UpdatedAt

规则排列依据。

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

Asc

Boolean

false

规则排序方式。

  • true:升序
  • false:降序

返回参数

参数类型示例值描述
AscBooleanfalse返回规则的排序方式。
DataArray of Rule-符合条件的规则的详细信息。
OrderByStringHappenTime返回规则的排序依据。
PageSizeInteger30分页查询参数,用于设置每页行数。默认值:30。
PageNumberInteger1分页查询参数,用于设置当前页码。默认值:1。
TotalCountInteger2符合条件的事件规则总数。

Rule

参数类型示例值描述
RuleIdString168*****4352事件规则ID。
SourceStringvke事件源。
RuleNameStringtest-kafka规则名称。
DescriptionStringThis is test rule 01规则描述。
EventBusNameStringdefault事件总线名称,目前仅支持填写default。
AccountIdString210****168主账号ID。
RegionStringcn-chengdu-sdv地域。
LevelStringcritical告警规则的严重程度。

EnableState

String

enable

规则状态。

  • enable:规则启用
  • disable:规则禁用
EffectStartAtString12:00规则启用的开始时间。
EffectEndAtString20:00规则启用的结束时间。
EventTypeArray of String["vke:Addon:AddonStatus.Failed"]事件类型。

FilterPattern

JSON Map

-

过滤模式,也叫事件匹配规则。
暂时不支持自定义匹配规则。

ContactMethods

Array of String

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

告警通知方式。

  • Phone:电话
  • Email:邮件
  • SMS:短信
  • Webhook:告警回调
  • TLS:日志服务
  • MQ:消息队列kafka
EndpointStringhttp://example.com/alert告警通知方式为告警回调时,触发的回调地址。
TLSTargetArray of TLSTargetInfo-告警方式为日志服务时,触发的日志服务的配置。
ContactGroupIdsArray of String["166*****7680"]告警通知组ID列表。当AlertMethods参数为Email,Phone,SMS时,ContactGroupIds参数不能为空。
MessageQueueArray of MQTarget-告警通知方式为消息队列kafka时,触发的消息队列。
UpdatedAtInteger1666686791事件规则更新时间。
CreatedAtInteger1666668613事件规则创建时间。
WebhookIdsArray of String-告警回调ID列表。

FilterPattern

参数类型示例值描述
keyString"Type": [ "vke:Addon:AddonStatus.Failed" ]模式匹配中对应的事件类型列表,当前为任意匹配。
valueAny"Source": "vke"模式匹配中对应的事件源。

TLSTargetInfo

参数类型示例值描述
TopicIdString6a6****67c7主题ID。
ProjectIdString79fe****122f项目ID。
ProjectNameStringtest项目的名称。
RegionNameCNString桑园区域的中文名称。
RegionNameENStringcn-guilin-boe区域的英文名称。

MQTarget

参数类型示例值描述
TypeStringkafka告警通知的方式。
TopicStringtestkafka消息队列的Topic。
VpcIdStringvpc-2bzq*****pm22VPC ID。
RegionStringcn-guilin-boeMQ实例region。
PasswordString-密码。
EndpointsString-集群地址,仅对rule_engine返回。
InstanceIdStringkafka-cno*****5hcMQ实例ID。
AuthEncryptArray of Integer-账号密码的密文,仅对rule_engine返回。

请求示例

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
    }
}

错误码

本接口无特有的错误码。更多信息请参见错误码