修改告警规则告警通知信息 - UpdateAlarmNotifications
功能介绍
修改告警规则告警通知信息,告警策略&资源请使用对应接口
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
- 如果使用身份策略授权,需具备如下身份策略权限。
授权项
访问级别
资源类型(*为必须)
条件键
别名
依赖的授权项
ces:alarms:putAlarmNotifications
Write
alarm *
g:ResourceTag/<tag-key>
g:EnterpriseProjectId
ces:alarms:put
-
URI
PUT /v2/{project_id}/alarms/{alarm_id}/notifications
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
project_id | 是 | String | 参数解释: 项目ID。用于明确项目归属,配置后可通过该ID查询项目下资产,可以通过调用API获取,也可以从控制台获取。获取方式请参见获取项目ID。 约束限制: 不涉及。 取值范围: 字符串的长度必须在 1 到 64个字符之间。 默认取值: 不涉及。 |
alarm_id | 是 | String | 参数解释: 告警规则ID 约束限制: 不涉及。 取值范围: 以al开头,后跟22位字母或数字。 默认取值: 不涉及。 |
请求参数
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
Content-Type | 否 | String | 参数解释: 发送的实体的MIME类型。 约束限制: 不涉及。 取值范围: 最小字符数量为1,最大为64。 默认取值: 默认使用application/json; charset=UTF-8。 |
X-Auth-Token | 否 | String | 参数解释: 用户Token。 约束限制: 不涉及。 取值范围: 最小字符数量为1,最大为16384。 默认取值: 不涉及。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
notification_enabled | 是 | Boolean | 参数解释: 是否开启告警通知。 约束限制: 不涉及。 取值范围: 布尔值。
默认取值: 不涉及。 |
alarm_notifications | 否 | Array of Notification objects | 参数解释: 触发告警时,通知组/主题订阅的信息。 约束限制: 包含的通知对象信息的数量最多为10个,最少为0个。 |
ok_notifications | 否 | Array of Notification objects | 参数解释: 告警恢复时,通知组/主题订阅的信息。 约束限制: 包含的通知对象信息的数量最多为10个,最少为0个。 |
notification_begin_time | 否 | String | 参数解释: 告警通知开启时间。 约束限制: 当notification_enabled字段为true时,该字段必填。 取值范围: 只能包含数字、“:”,长度为[1,64]个字符。 默认取值: 不涉及。 |
notification_end_time | 否 | String | 参数解释: 告警通知关闭时间。 约束限制: 当notification_enabled字段为true时,该字段必填。 取值范围: 只能包含数字、“:”,长度为[1,64]个字符。 默认取值: 不涉及。 |
effective_timezone | 否 | String | 参数解释: 时区,形如:"GMT-08:00"、"GMT+08:00"、"GMT+0:00"。 约束限制: 不涉及。 取值范围: 长度为[1,16]个字符。 默认取值: 不涉及。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
type | 是 | String | 参数解释: 通知类型。 约束限制: 不涉及。 取值范围: 枚举值。
默认取值: 不涉及。 |
notification_list | 是 | Array of strings | 参数解释: 告警状态发生变化时,被通知对象的列表。topicUrn可从SMN获取,具体操作请参考查询Topic列表。 约束限制: 当type为notification时,notification_list列表不能为空;当type为autoscaling时,列表必须为[]。若notification_enabled为true,对应的alarm_notifications、ok_notifications至少有一个不能为空。若alarm_notifications、ok_notification同时存在时,notification_list值保持一致。最多包含20个通知对象,最少可以为0个。 |
响应参数
状态码:200
参数 | 参数类型 | 描述 |
|---|---|---|
notification_enabled | Boolean | 参数解释: 是否开启告警通知。 取值范围: 布尔值。
|
alarm_notifications | Array of NotificationResp objects | 参数解释: 触发告警时,通知组/主题订阅的信息。 |
ok_notifications | Array of NotificationResp objects | 参数解释: 告警恢复时,通知组/主题订阅的信息。 |
notification_begin_time | String | 参数解释: 告警通知开启时间。如 00:00 取值范围: 只能包含数字、“:”,长度为[1,64]个字符。 |
notification_end_time | String | 参数解释: 告警通知关闭时间。如 08:00 取值范围: 只能包含数字、“:”,长度为[1,64]个字符。 |
effective_timezone | String | 参数解释: 时区,形如:"GMT-08:00"、"GMT+08:00"、"GMT+0:00"。 取值范围: 长度为[1,16]个字符。 |
notification_manner | String | 参数解释: 告警的通知方式 取值范围:
|
notification_policy_ids | Array of strings | 参数解释: 关联的通知策略ID列表 |
参数 | 参数类型 | 描述 |
|---|---|---|
type | String | 参数解释: 通知类型。 取值范围: 枚举值。
|
notification_list | Array of strings | 参数解释: 告警状态发生变化时,被通知对象的列表。topicUrn可从SMN获取,具体操作请参考查询Topic列表。 |
状态码:400
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 请求异常内部业务状态码 |
error_msg | String | 请求异常信息 |
request_id | String | 请求ID |
状态码:500
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 请求异常内部业务状态码 |
error_msg | String | 请求异常信息 |
request_id | String | 请求ID |
请求示例
修改告警规则告警通知信息
{
"notification_enabled" : true,
"alarm_notifications" : [ {
"type" : "notification",
"notification_list" : [ "urn:smn:cn-north-7:65c438cab60xxxxxxx:CES_notification_group_MGj4AJ03X" ]
} ],
"ok_notifications" : [ {
"type" : "notification",
"notification_list" : [ "urn:smn:cn-north-7:65c438cab60xxxxxxx:CES_notification_group_MGj4AJ03X" ]
} ],
"notification_begin_time" : "00:00",
"notification_end_time" : "23:59"
} 响应示例
状态码:200
修改告警规则告警通知信息成功
{
"notification_enabled" : true,
"alarm_notifications" : [ {
"type" : "",
"notification_list" : [ "urn:smn:cn-north-7:65c438cab60xxxxxxx:CES_notification_group_MGj4AJ03X" ]
} ],
"ok_notifications" : [ {
"type" : "",
"notification_list" : [ "urn:smn:cn-north-7:65c438cab60xxxxxxx:CES_notification_group_MGj4AJ03X" ]
} ],
"notification_begin_time" : "00:00",
"notification_end_time" : "23:59",
"effective_timezone" : "",
"notification_manner" : "",
"notification_policy_ids" : null
} 状态码
状态码 | 描述 |
|---|---|
200 | 修改告警规则告警通知信息成功 |
400 | 参数校验失败 |
500 | 系统内部错误 |
错误码
请参见错误码。

