更新时间:2024-03-21 GMT+08:00
分享

新增通知规则

功能介绍

新增对应指标的通知规则;对应指标满足相应的规则条件时发送通知 同一指标的规则不允许重复; 统计指标名称,目前仅支持固定值:desktop_idle_duration

  • desktop_idle_duration - 桌面空闲时长, 仅允许设置 '>=' 阈值 注:需先为云服务添加委托授权,否则无法正常发送通知到SMN

调试

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

URI

POST /v2/{project_id}/statistics/notify-rules

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

表3 请求Body参数

参数

是否必选

参数类型

描述

metric_name

String

统计指标名称,目前仅支持固定值:desktop_idle_duration 同一指标的规则不允许重复

  • desktop_idle_duration - 桌面空闲时长, 仅允许设置 '>=' threshold

threshold

Integer

规则配置-阈值(天)

comparison_operator

String

统计指标对应的统计值和threshold进行比较的条件

  • >= - 统计指标大于等于threshold时触发

  • > - 统计指标大于threshold时触发

  • = - 统计指标等于threshold时触发

  • <= - 统计指标小于等于threshold时触发

  • < - 统计指标小于threshold时触发

interval

Integer

触发通知后;下次通知的间隔时间;默认每天一次

enable

Boolean

启禁用规则 true:启用 false:禁用

notify_object

String

通知对象;smn的主题urn

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

rule_id

String

规则ID

metric_name

String

统计指标名称,目前仅支持固定值:desktop_idle_duration

  • desktop_idle_duration - 桌面空闲时长

threshold

Integer

统计持续周期(天)

comparison_operator

String

统计指标对应的统计值和threshold进行比较的条件

  • >= - 统计指标大于等于threshold时触发

  • > - 统计指标大于threshold时触发

  • = - 统计指标等于threshold时触发

  • <= - 统计指标小于等于threshold时触发

  • < - 统计指标小于threshold时触发

interval

Integer

触发通知后;下次通知的间隔时间;默认每天一次

enable

Boolean

启禁用规则 true:启用 false:禁用

notify_object

String

通知对象;smn的主题urn

状态码: 400

表5 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

状态码: 401

表6 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

状态码: 500

表7 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

请求示例

响应示例

状态码

状态码

描述

200

响应成功

400

客户端请求有误

401

鉴权失败

500

内部错误

错误码

请参见错误码

相关文档