文档首页> 云监控服务 CES> API参考> API V2> 一键告警> 查询一键告警关联告警规则列表
更新时间:2024-04-26 GMT+08:00
分享

查询一键告警关联告警规则列表

功能介绍

查询一键告警关联告警规则列表

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

GET /v2/{project_id}/one-click-alarms/{one_click_alarm_id}/alarms

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户ID

最小长度:1

最大长度:64

正则匹配:^[a-zA-Z0-9-]{1,64}$

one_click_alarm_id

String

一键告警ID

最小长度:1

最大长度:64

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

Content-Type

String

发送的实体的MIME类型。默认使用application/json; charset=UTF-8。

缺省值:application/json; charset=UTF-8

最小长度:1

最大长度:64

X-Auth-Token

String

用户Token

最小长度:1

最大长度:16384

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

alarms

Array of alarms objects

告警规则列表

数组长度:1 - 100

表4 alarms

参数

参数类型

描述

alarm_id

String

告警规则ID,以al开头,包含22个数字或字母

name

String

告警名称, 只能包含0-9/a-z/A-Z/_/-或汉字,长度1-128

description

String

告警描述,长度0-256

namespace

String

指标命名空间

policies

Array of Policy objects

告警策略

数组长度:1 - 100

resources

Array of ResourcesInListResp objects

资源列表,关联资源需要使用查询告警规则资源接口获取

数组长度:1 - 3000

type

String

告警规则类型

enabled

Boolean

告警开关

notification_enabled

Boolean

是否开启告警通知

alarm_notifications

Array of SMNAction objects

告警触发的动作

ok_notifications

Array of SMNAction objects

告警恢复触发的动作

notification_begin_time

String

告警通知开启时间

notification_end_time

String

告警通知关闭时间

表5 Policy

参数

参数类型

描述

alarm_policy_id

String

告警规则策略ID

metric_name

String

指标名称

period

Integer

告警条件判断周期,单位秒,1表示以原始数据判断告警,当告警的alarm_type为(EVENT.SYS|EVENT.CUSTOM)时可能为0

枚举值:

  • 0

  • 1

  • 300

  • 1200

  • 3600

  • 14400

  • 86400

filter

String

聚合方式

comparison_operator

String

告警阈值的比较条件

value

Number

阈值

unit

String

单位

count

Integer

次数

suppress_duration

Integer

抑制周期,单位秒,0表示只告警一次

枚举值:

  • 0

  • 300

  • 600

  • 900

  • 1800

  • 3600

  • 10800

  • 21600

  • 43200

  • 86400

level

Integer

告警级别, 1为紧急,2为重要,3为次要,4为提示

enabled

Boolean

开关

表6 ResourcesInListResp

参数

参数类型

描述

resource_group_id

String

资源分组ID,监控范围为资源分组时存在该值

正则匹配:^rg([a-z]|[A-Z]|[0-9]){22}$

resource_group_name

String

资源分组名称,监控范围为资源分组时存在该值

最小长度:1

最大长度:128

dimensions

Array of MetricDimension objects

维度信息

数组长度:0 - 10000

表7 MetricDimension

参数

参数类型

描述

name

String

指标维度名称

最小长度:1

最大长度:32

正则匹配:^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){1,32}$

value

String

指标维度值

最小长度:0

最大长度:256

正则匹配:^((([a-z]|[A-Z]|[0-9]){1}([a-z]|[A-Z]|[0-9]|_|-)*)|){0,256}$

表8 SMNAction

参数

参数类型

描述

type

String

通知类型,枚举类型:notification,autoscaling,groupwatch,ecsRecovery,contact,contactGroup,iecAction

枚举值:

  • notification

  • autoscaling

  • groupwatch

  • ecsRecovery

  • contact

  • contactGroup

  • iecAction

正则匹配:^(notification|autoscaling|groupwatch|ecsRecovery|contact|contactGroup|iecAction)$

notification_list

Array of strings

告警状态发生变化时,被通知对象的列表。topicUrn可从SMN获取,具体操作请参考查询Topic列表。当type为notification时,notificationList列表不能为空;当type为autoscaling时,列表必须为[]。 说明:若alarm_action_enabled为true,对应的alarm_actions、ok_actions至少有一个不能为空。若alarm_actions、ok_actions同时存在时,notificationList值保持一致。

数组长度:0 - 20

状态码: 400

表9 响应Body参数

参数

参数类型

描述

error_code

String

请求异常内部业务状态码

最小长度:0

最大长度:256

error_msg

String

请求异常信息

最小长度:0

最大长度:256

request_id

String

请求ID

最小长度:0

最大长度:256

状态码: 401

表10 响应Body参数

参数

参数类型

描述

error_code

String

请求异常内部业务状态码

最小长度:0

最大长度:256

error_msg

String

请求异常信息

最小长度:0

最大长度:256

request_id

String

请求ID

最小长度:0

最大长度:256

状态码: 403

表11 响应Body参数

参数

参数类型

描述

error_code

String

请求异常内部业务状态码

最小长度:0

最大长度:256

error_msg

String

请求异常信息

最小长度:0

最大长度:256

request_id

String

请求ID

最小长度:0

最大长度:256

状态码: 500

表12 响应Body参数

参数

参数类型

描述

error_code

String

请求异常内部业务状态码

最小长度:0

最大长度:256

error_msg

String

请求异常信息

最小长度:0

最大长度:256

request_id

String

请求ID

最小长度:0

最大长度:256

请求示例

响应示例

状态码: 200

OK

{
  "alarms" : [ {
    "alarm_id" : "al123232232341232132",
    "name" : "alarm1",
    "description" : "hello world",
    "namespace" : "SYS.ECS",
    "policies" : [ {
      "alarm_policy_id" : "alxdxxxdsw12321321",
      "metric_name" : "cpu_util",
      "period" : 0,
      "filter" : "max",
      "comparison_operator" : "",
      "value" : 1.7976931348623156E108,
      "unit" : "%",
      "count" : 100,
      "suppress_duration" : 0,
      "level" : 2,
      "enabled" : true
    } ],
    "resources" : [ {
      "dimensions" : [ {
        "name" : "string",
        "value" : "string"
      } ]
    } ],
    "type" : "EVENT.SYS",
    "enabled" : true,
    "notification_enabled" : true,
    "alarm_notifications" : [ {
      "type" : "notification",
      "notification_list" : [ "urn:smn:123" ]
    } ],
    "ok_notifications" : [ {
      "type" : "notification",
      "notification_list" : [ "urn:smn:123" ]
    } ],
    "notification_begin_time" : "00:00",
    "notification_end_time" : "23:59"
  } ]
}

状态码

状态码

描述

200

OK

400

参数校验失败

401

未认证

403

认证鉴权失败

500

系统内部错误

错误码

请参见错误码

分享:

    相关文档

    相关产品