Buat atau perbarui kebijakan notifikasi.
Coba sekarang
Test
RAM authorization
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| Id |
integer |
No |
ID kebijakan notifikasi.
|
1234 |
| Name |
string |
Yes |
Nama kebijakan notifikasi. |
notificationpolicy_test |
| MatchingRules |
string |
No |
Aturan yang digunakan untuk mencocokkan peristiwa peringatan. Formatnya adalah sebagai berikut: |
[ { "matchingConditions": [ { "value": "test", "key": "alertname", "operator": "eq" } ] } ] |
| SendRecoverMessage |
boolean |
No |
Menentukan apakah status peringatan secara otomatis dipulihkan ke Resolved ketika semua peristiwa di bawah peringatan tersebut dipulihkan. Ketika peringatan dipulihkan, sistem mengirim notifikasi kepada penanggung jawab.
|
true |
| GroupRule |
string |
No |
Mengatur pengelompokan peristiwa.
|
{ "groupWait":5, "groupInterval":30, "groupingFields":["alertname"] } |
| NotifyRule |
string |
Yes |
Mengatur aturan notifikasi. Formatnya adalah sebagai berikut: |
{ "notifyStartTime": "00:00", "notifyEndTime": "23:59", "notifyChannels": [ "dingTalk", "email", "sms", "tts", "webhook" ], "notifyObjects": [ { "notifyObjectType": "CONTACT", "notifyObjectId": 123, "notifyObjectName": "test", "notifyChannels": [ "email", "sms", "tts" ], } ] } |
| NotifyTemplate |
string |
No |
Template notifikasi. Untuk contoh template, lihat deskripsi di bawah tabel. |
{ "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}}" } |
| EscalationPolicyId |
integer |
No |
ID kebijakan eskalasi. |
123 |
| Repeat |
boolean |
No |
Menentukan apakah akan mengirim notifikasi berulang untuk peringatan yang belum diselesaikan dalam waktu yang lama.
|
true |
| RepeatInterval |
integer |
No |
Interval notifikasi berulang, dalam detik. |
600 |
| IntegrationId |
integer |
No |
Sistem tiket tempat peringatan akan dikirim. Masukkan ID integrasi sistem tiket. |
34 |
| RegionId |
string |
No |
ID region. |
cn-hangzhou |
| DirectedMode |
boolean |
No |
Mode minimalis. |
false |
| State |
string |
No |
Apakah kebijakan notifikasi diaktifkan. Nilai yang valid: enable (diaktifkan), disable (dinonaktifkan). |
enable |
Contoh template notifikasi default NotifyTemplate
{
//Notifikasi peringatan email
"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 }}",
//Notifikasi pemulihan peringatan email
"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 }}",
//Notifikasi peringatan SMS
"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 }}",
//Notifikasi pemulihan peringatan SMS
"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 }}",
//Notifikasi peringatan telepon
"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 }}",
//Notifikasi pemulihan peringatan telepon
"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 }}",
//Notifikasi peringatan robot
"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}}"
}
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
Skema Respons |
||
| RequestId |
string |
ID permintaan. |
A5EC8221-08F2-4C95-9AF1-49FD998C**** |
| NotificationPolicy |
object |
Objek kebijakan notifikasi. |
|
| Id |
integer |
ID kebijakan notifikasi. |
1234 |
| Name |
string |
Nama kebijakan notifikasi. |
notificationpolicy_test |
| MatchingRules |
array<object> |
Aturan yang digunakan untuk mencocokkan peristiwa peringatan. |
|
|
array<object> |
|||
| MatchingConditions |
array<object> |
The matching conditions. |
|
|
object |
|||
| Key |
string |
The key of the matching condition. |
altertname |
| Value |
string |
The value of the matching condition. |
test |
| Operator |
string |
The logical operator of the matching condition. Valid values:
|
eq |
| SendRecoverMessage |
boolean |
Menentukan apakah status peringatan secara otomatis dipulihkan ke Resolved ketika semua peristiwa di bawah peringatan tersebut dipulihkan. Ketika peringatan dipulihkan, sistem mengirim notifikasi kepada penanggung jawab.
|
true |
| GroupRule |
object |
Pengelompokan peristiwa. |
|
| GroupingFields |
array |
An array of alert event group objects.
|
|
|
string |
The field that is used for grouping. |
["alertName","clustname"] |
|
| GroupWait |
integer |
The waiting time for grouping. Unit: seconds. Default value: 5. |
5 |
| GroupInterval |
integer |
The time interval of grouping. Unit: seconds. Default value: 30. |
30 |
| NotifyRule |
object |
Aturan notifikasi. |
|
| NotifyStartTime |
string |
The start time of the notification window. |
00:00 |
| NotifyEndTime |
string |
The end time of the notification window. |
23:59 |
| NotifyChannels |
array |
The notification method. |
|
|
string |
The notification methods. Valid values:
|
["dingTalk", "email", "sms", "tts", "webhook"] |
|
| NotifyObjects |
array<object> |
An array of notification objects. |
|
|
object |
The information about the notification object. |
||
| NotifyObjectType |
string |
The type of the notification object. Valid values:
|
CONTACT |
| NotifyObjectId |
integer |
The ID of the notification object. |
123 |
| NotifyObjectName |
string |
The name of the notification object. |
test |
| NotifyChannels |
array |
The notification methods specified for a contact. |
|
|
string |
The notification methods. Valid values:
|
sms |
|
| NotifyTemplate |
object |
Template notifikasi. |
|
| EmailTitle |
string |
The title of the alert notification sent through email. |
{{ .commonLabels.alertname }} |
| EmailContent |
string |
The content of the alert notification sent through email. |
告警名称:{{ .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 |
The title of the alert resolution notification sent through email. |
{{ .commonLabels.alertname }} |
| EmailRecoverContent |
string |
The content of the alert resolution notification sent through email. |
告警名称:{{ .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 |
The content of the alert notification sent through text message. |
发生{{ .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 |
The content of the alert resolution notification sent through text message. |
告警已经恢复 告警名称:{{ .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 |
The content of the alert notification by phone. |
告警名称:{{ .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 |
The content of the alert resolution notification by phone. |
告警名称:{{ .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 |
The content of the alert notification sent by the IM robot. |
{{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}} |
| EscalationPolicyId |
integer |
ID kebijakan eskalasi. |
123 |
| Repeat |
boolean |
Menentukan apakah akan mengirim notifikasi berulang untuk peringatan yang belum diselesaikan dalam waktu yang lama.
|
true |
| RepeatInterval |
integer |
Interval notifikasi berulang, dalam detik. |
600 |
| IntegrationId |
integer |
Sistem tiket tempat peringatan akan dikirim, ditampilkan sebagai ID integrasi sistem tiket. |
34 |
| DirectedMode |
boolean |
Mode minimalis. |
|
| State |
string |
Apakah kebijakan notifikasi diaktifkan. Nilai yang valid: enable (diaktifkan), disable (dinonaktifkan). |
enable |
Contoh
Respons sukses
JSONformat
{
"RequestId": "A5EC8221-08F2-4C95-9AF1-49FD998C****",
"NotificationPolicy": {
"Id": 1234,
"Name": "notificationpolicy_test",
"MatchingRules": [
{
"MatchingConditions": [
{
"Key": "altertname",
"Value": "test",
"Operator": "eq"
}
]
}
],
"SendRecoverMessage": true,
"GroupRule": {
"GroupingFields": [
"[\"alertName\",\"clustname\"]"
],
"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": [
"sms"
]
}
]
},
"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}}"
},
"EscalationPolicyId": 123,
"Repeat": true,
"RepeatInterval": 600,
"IntegrationId": 34,
"DirectedMode": false,
"State": "enable"
}
}
Kode kesalahan
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.