通知ポリシーを作成または変更します。
今すぐお試しください
テスト
RAM 認証
リクエストパラメーター
|
パラメーター |
型 |
必須 / 任意 |
説明 |
例 |
| Id |
integer |
任意 |
通知ポリシーの ID。
|
1234 |
| Name |
string |
必須 |
通知ポリシーの名前。 |
notificationpolicy_test |
| MatchingRules |
string |
任意 |
マッチングルール。フォーマット: |
[ { "matchingConditions": [ { "value": "test", "key": "alertname", "operator": "eq" } ] } ] |
| SendRecoverMessage |
boolean |
任意 |
アラートに関連するすべてのイベントが復元済みの状態に変わったときに、アラートのステータスを自動的に解決済みに変更するかどうかを指定します。ARMS は、アラートのステータスが解決済みに変更されると、連絡先に通知します。
|
true |
| GroupRule |
string |
任意 |
アラートイベントグループオブジェクトの配列。
サンプル文: |
{ "groupWait":5, "groupInterval":30, "groupingFields":["alertname"] } |
| NotifyRule |
string |
必須 |
通知ルールオブジェクトの配列。フォーマット: |
{ "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 |
任意 |
通知テンプレート。デフォルトの通知テンプレートは、表の下に記載されています。 |
{ "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 |
任意 |
エスカレーションポリシーの ID。 |
123 |
| Repeat |
boolean |
任意 |
長時間未解決のアラートに対して通知を再送するかどうかを指定します。デフォルト値:true。有効な値:
|
true |
| RepeatInterval |
integer |
任意 |
長時間未解決のアラートに対して通知を再送する時間間隔。単位:秒。 |
600 |
| IntegrationId |
integer |
任意 |
アラートがプッシュされるチケットシステムの統合 ID。 |
34 |
| RegionId |
string |
任意 |
リージョン ID。 |
cn-hangzhou |
| DirectedMode |
boolean |
任意 |
シンプルモードを有効にするかどうかを指定します。 |
false |
| State |
string |
任意 |
通知ポリシーを有効にするかどうかを指定します。有効な値: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 }}",
// 電話によるアラート通知
"tsContent":"アラート名: {{ .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 }}",
// IM (インスタントメッセージ) ロボットによって送信されるアラート通知
"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}}"
}
レスポンスフィールド
|
フィールド |
型 |
説明 |
例 |
|
object |
応答のスキーマ |
||
| RequestId |
string |
リクエスト ID。 |
A5EC8221-08F2-4C95-9AF1-49FD998C**** |
| NotificationPolicy |
object |
通知ポリシーオブジェクトの配列。 |
|
| Id |
integer |
通知ポリシーの ID。 |
1234 |
| Name |
string |
通知ポリシーの名前。 |
notificationpolicy_test |
| MatchingRules |
array<object> |
マッチングルール。 |
|
|
array<object> |
|||
| MatchingConditions |
array<object> |
マッチング条件。 |
|
|
object |
|||
| Key |
string |
マッチング条件のキー。 |
altertname |
| Value |
string |
マッチング条件の値。 |
test |
| Operator |
string |
マッチング条件の論理演算子。有効な値:
|
eq |
| SendRecoverMessage |
boolean |
アラートに関連するすべてのイベントが復元済みの状態に変わったときに、アラートのステータスを自動的に解決済みに変更するかどうかを示します。ARMS は、アラートのステータスが解決済みに変更されると、連絡先に通知します。
|
true |
| GroupRule |
object |
アラートイベントグループオブジェクトの配列。 |
|
| GroupingFields |
array |
アラートイベントグループオブジェクトの配列。
|
|
|
string |
グルーピングに使用されるフィールド。 |
["alertName","clustname"] |
|
| 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 |
通知方法。有効な値:
|
sms |
|
| 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 |
IM ロボットによって送信されるアラート通知の内容。 |
{{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。 |
123 |
| Repeat |
boolean |
長時間未解決のアラートに対して通知が再送されるかどうかを示します。デフォルト値:true。有効な値:
|
true |
| RepeatInterval |
integer |
長時間未解決のアラートに対して通知が再送される時間間隔。単位:秒。 |
600 |
| IntegrationId |
integer |
アラートがプッシュされるチケットシステムの統合 ID。 |
34 |
| DirectedMode |
boolean |
シンプルモードを有効にするかどうかを指定します。 |
false |
| State |
string |
通知ポリシーが有効になっているかどうかを示します。有効な値:enable と disable。 |
enable |
例
成功レスポンス
JSONJSON
{
"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"
}
}
エラーコード
完全なリストについては、「エラーコード」をご参照ください。
変更履歴
完全なリストについては、「変更履歴」をご参照ください。