通过指定条件查询通知策略信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| Name |
string |
否 |
通知策略名称。 |
notificationpolicy_test |
| Page |
integer |
是 |
查询页数。 |
1 |
| Size |
integer |
是 |
每页展示的数目。 |
20 |
| IsDetail |
boolean |
否 |
是否查询通知策略详情。
|
false |
| RegionId |
string |
否 |
地域 id。默认为cn-hangzhou。 |
cn-hangzhou |
| Ids |
string |
否 |
通知策略 ID。 |
12345 |
| DirectedMode |
boolean |
否 |
极简模式 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| RequestId |
string |
请求 ID。 |
78901766-3806-4E96-8E47-CFEF59E4**** |
| PageBean |
object |
分页对象。 |
|
| Total |
integer |
查询到的通知策略总数。 |
24 |
| Page |
integer |
查询到的页数。 |
1 |
| Size |
integer |
每页展示数目。 |
20 |
| NotificationPolicies |
array<object> |
通知策略信息。 |
|
|
array<object> |
通知策略对象。 |
||
| Id |
integer |
通知策略 ID。 |
1234 |
| Name |
string |
通知策略名称。 |
notificationpolicy_test |
| MatchingRules |
array<object> |
匹配告警事件规则。 |
|
|
array<object> |
|||
| MatchingConditions |
array<object> |
匹配条件。 |
|
|
object |
|||
| Key |
string |
匹配条件 Key。 |
altertname |
| Value |
string |
匹配条件 Value。 |
test |
| Operator |
string |
匹配条件聚合方式。
|
eq |
| SendRecoverMessage |
boolean |
当告警下面全部事件都恢复时,告警状态是否自动恢复为已解决。当告警恢复时,系统将会发送通知给处理人。
|
true |
| GroupRule |
object |
事件分组。 |
|
| GroupingFields |
array |
设置事件分组。
|
|
|
string |
分组字段。 |
["alertname"] |
|
| GroupWait |
integer |
分组等待时间,默认为 5 秒。 |
5 |
| GroupInterval |
integer |
分组间隔时间,默认为 30 秒。 |
30 |
| NotifyRule |
object |
通知规则。 |
|
| NotifyStartTime |
string |
通知时间段开始时间。 |
00:00 |
| NotifyEndTime |
string |
通知时间段结束时间。 |
23:59 |
| NotifyChannels |
array |
通知方式。 |
|
|
string |
通知方式。
|
[ "dingTalk", "email", "sms", "tts","webhook" ] |
|
| NotifyObjects |
array<object> |
通知对象。 |
|
|
object |
|||
| NotifyObjectType |
string |
通知对象类型。
|
CONTACT |
| NotifyObjectId |
integer |
通知对象 ID。 |
123 |
| NotifyObjectName |
string |
通知对象名称。 |
test |
| NotifyChannels |
array |
通知对象为联系人时单独的联系方式 |
|
|
string |
通知方式。
|
[ "email", "sms", "tts" ] |
|
| NotifyTemplate |
object |
通知模板。 |
|
| EmailTitle |
string |
邮件告警通知标题。 |
{{ .commonLabels.alertname }} |
| EmailContent |
string |
邮件告警通知内容。 |
告警名称:{{ .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 }} 详情链接 {{ end }} {{ end }} |
| EmailRecoverTitle |
string |
邮件告警恢复通知标题。 |
{{ .commonLabels.alertname }} |
| EmailRecoverContent |
string |
邮件告警恢复通知内容。 |
告警名称:{{ .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 }} 详情链接 {{ end }} {{ end }} |
| SmsContent |
string |
短信告警通知内容。 |
发生{{ .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 |
string |
短信告警恢复通知内容。 |
告警已经恢复 告警名称:{{ .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 |
string |
电话告警通知内容。 |
告警名称:{{ .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 |
string |
电话告警恢复通知内容。 |
告警名称:{{ .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 |
string |
机器人告警通知内容。 |
{{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}} |
| Repeat |
boolean |
对于长期未解决的告警是否发送重复通知。
|
true |
| RepeatInterval |
integer |
重复通知时间间隔,单位为秒。 |
600 |
| EscalationPolicyId |
integer |
升级规则 ID。 |
123 |
| IntegrationId |
integer |
告警需要推送到的工单系统,显示为工单系统的集成 ID。 |
34 |
| DirectedMode |
boolean |
极简模式 |
|
| State |
string |
通知策略是否启用,enable 启用,disable 停用 |
enable |
示例
正常返回示例
JSON格式
{
"RequestId": "78901766-3806-4E96-8E47-CFEF59E4****",
"PageBean": {
"Total": 24,
"Page": 1,
"Size": 20,
"NotificationPolicies": [
{
"Id": 1234,
"Name": "notificationpolicy_test",
"MatchingRules": [
{
"MatchingConditions": [
{
"Key": "altertname",
"Value": "test",
"Operator": "eq"
}
]
}
],
"SendRecoverMessage": true,
"GroupRule": {
"GroupingFields": [
"[\"alertname\"]"
],
"GroupWait": 5,
"GroupInterval": 30
},
"NotifyRule": {
"NotifyStartTime": "00:00",
"NotifyEndTime": "23:59",
"NotifyChannels": [
"[ \"dingTalk\", \"email\", \"sms\", \"tts\",\"webhook\" ]"
],
"NotifyObjects": [
{
"NotifyObjectType": "CONTACT",
"NotifyObjectId": 123,
"NotifyObjectName": "test",
"NotifyChannels": [
"[ \"email\", \"sms\", \"tts\" ]"
]
}
]
},
"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 }} 详情链接 {{ 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 }} 详情链接 {{ 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}}"
},
"Repeat": true,
"RepeatInterval": 600,
"EscalationPolicyId": 123,
"IntegrationId": 34,
"DirectedMode": true,
"State": "enable"
}
]
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。