CreateOrUpdateNotificationPolicy
创建或更新通知策略
服务地址:
华东1 金融云
输入参数
只看必填
Id通知策略ID
Name通知策略名称
MatchingRules匹配告警事件规则
SendRecoverMessage当告警下面全部事件都恢复时
请选择布尔值
GroupRule设置事件分组
NotifyRule设置通知规则
NotifyTemplate通知模板
EscalationPolicyId升级规则ID
Repeat对于长期未解决的告警是否发送重复通知
请选择布尔值
RepeatInterval重复通知时间间隔
IntegrationId告警需要推送到的工单系统
RegionId地域ID
DirectedMode极简模式
请选择布尔值
State通知策略是否启用
插件下载了解更多
VS Code 插件
安装插件之前,确保已安装 VS Code安装插件之前,确保已安装 VS Code
Alibaba Cloud Developer Toolkit is a collection of extensions that can help access Alibaba Cloud services in Visual Studio Code.
JetBrains 插件
安装插件之前,确保已安装 JetBrains IDE安装插件之前,确保已安装 JetBrains IDE
The Alibaba Cloud Developer Toolkit for JetBrains makes it easier to access Alibaba Cloud services.

请求参数

字段名称字段详情
Idinteger<int64>

通知策略 ID。展开详情

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:1234
Namestring

通知策略名称。

示例值:notificationpolicy_test
MatchingRulesstring

匹配告警事件规则。格式如下:展开详情

示例值:[ { "matchingConditions": [ { "value": "test", "key": "alertname", "operator": "eq" } ] } ]
SendRecoverMessageboolean

当告警下面全部事件都恢复时,告警状态是否自动恢复为已解决。当告警恢复时,系统将会发送通知给处理人。展开详情

示例值:true
GroupRulestring

设置事件分组。展开详情

示例值:{ "groupWait":5, "groupInterval":30, "groupingFields":["alertname"] }参考取值来源:
    DescribeDispatchRule
NotifyRulestring

设置通知规则。格式如下:展开详情

示例值:{ "notifyStartTime": "00:00", "notifyEndTime": "23:59", "notifyChannels": [ "dingTalk", "email", "sms", "tts", "webhook" ], "notifyObjects": [ { "notifyObjectType": "CONTACT", "notifyObjectId": 123, "notifyObjectName": "test", "notifyChannels": [ "email", "sms", "tts" ], } ] }
NotifyTemplatestring

通知模板。示例模板请参见表格下方说明。

示例值:{ "robotContent":"{{if .commonLabels.clustername }} > 集群名称:{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} > 应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}{{ for .alerts }} > {{ .annotations.message }} {{if .generatorURL }} [详情链接]({{.generatorURL}}) {{end}} {{if eq "true" .labels._aliyun_arms_is_denoise_filtered }} (疑似噪音) {{end}} {{end}}" }
EscalationPolicyIdinteger<int64>

升级规则 ID。

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:123
Repeatboolean

对于长期未解决的告警是否发送重复通知。展开详情

示例值:true
RepeatIntervalinteger<int64>

重复通知时间间隔,单位为秒。

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:600
IntegrationIdinteger<int64>

告警需要推送到的工单系统,填写工单系统的集成 ID。

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:34参考取值来源:
    UpdateIntegration
    ListIntegration
    CreateIntegration
RegionIdstring

地域 ID。

示例值:cn-hangzhou
DirectedModeboolean

极简模式

示例值:false
Statestring

通知策略是否启用,enable 启用,disable 停用

示例值:enable

请求说明

NotifyTemplate 默认通知模板示例

{
//邮件告警通知
"emailTitle":"{{ .commonLabels.alertname }}",

"emailContent":"告警名称:{{ .commonLabels.alertname }}{{if .commonLabels.clustername }} 集群名称:{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} 应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} 通知策略:{{ .dispatchRuleName }} 告警时间:{{ .startTime }} 告警内容:{{ for .alerts }} {{ .annotations.message }}  {{if .generatorURL }}  <a href="{{.generatorURL}}" > 详情链接</a>  {{ end }} {{ end }}",

//邮件告警恢复通知
"emailRecoverTitle":"{{ .commonLabels.alertname }}",

"emailRecoverContent":"告警名称:{{ .commonLabels.alertname }}{{if .commonLabels.clustername }} 集群名称:{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} 应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} 通知策略:{{ .dispatchRuleName }} 恢复时间:{{ .endTime }} 告警内容:{{ for .alerts }} {{ .annotations.message }}  {{if .generatorURL }} <a href="{{.generatorURL}}" > 详情链接</a>  {{ end }} {{ end }}",

//短信告警通知
"smsContent":"发生{{ .level }}告警 告警名称:{{ .commonLabels.alertname }}{{if .commonLabels.clustername }} 集群名称:{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} 应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} 通知策略:{{ .dispatchRuleName }} 告警时间:{{ .startTime }} 告警内容:{{ for .alerts }} {{ .annotations.message }} {{ end }}",

//短信告警恢复通知
"smsRecoverContent":"告警已经恢复 告警名称:{{ .commonLabels.alertname }}{{if .commonLabels.clustername }} 集群名称:{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} 应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} 通知策略:{{ .dispatchRuleName }} 恢复时间:{{ .endTime }} 告警内容:{{ for .alerts }} {{ .annotations.message }} {{ end }}",

//电话告警通知
"ttsContent":"告警名称:{{ .commonLabels.alertname }}{{if .commonLabels.clustername }} 集群名称:{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} 应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} 通知策略:{{ .dispatchRuleName }} 告警时间:{{ .startTime }} 告警内容:{{ for .alerts }} {{ .annotations.message }} {{ end }}",

//电话告警恢复通知
"ttsRecoverContent":"告警名称:{{ .commonLabels.alertname }}{{if .commonLabels.clustername }} 集群名称:{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} 应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} 通知策略:{{ .dispatchRuleName }} 恢复时间:{{ .endTime }} 告警内容:{{ for .alerts }} {{ .annotations.message }} {{ end }}",

//机器人告警通知
"robotContent":"{{if .commonLabels.clustername }}   >  集群名称:{{ .commonLabels.clustername }}    {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}   >  应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }}    {{ end }}{{ for .alerts }} >  {{ .annotations.message }} {{if .generatorURL }} [详情链接]({{.generatorURL}}) {{end}} {{if  eq "true" .labels._aliyun_arms_is_denoise_filtered }} (疑似噪音) {{end}}  {{end}}",

//机器人告警恢复通知
"robotRecoverContent":"{{if .commonLabels.clustername }}   >  集群名称:{{ .commonLabels.clustername }}    {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}   >  应用名称:{{ .commonLabels._aliyun_arms_involvedObject_name }}    {{ end }}{{ for .alerts }} >  {{ .annotations.message }} {{if .generatorURL }} [详情链接]({{.generatorURL}}) {{end}} {{if  eq "true" .labels._aliyun_arms_is_denoise_filtered }} (疑似噪音) {{end}}  {{end}}"

}

返回参数

字段名称字段详情
RequestIdstring

请求 ID。

示例值:A5EC8221-08F2-4C95-9AF1-49FD998C****
NotificationPolicyobject

通知策略对象。

变更历史
变更时间变更内容概要操作
2024-06-19
新增请求参数State
变更返回参数
2023-08-17
新增请求参数DirectedMode
变更返回参数
  • 1
  • 2
  • 10 条/页