All Products
Search
Document Center

Application Real-Time Monitoring Service:ListNotificationPolicies

Last Updated:Nov 05, 2024

Queries notification policies based on specified conditions.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
arms:ListDispatchRulenone
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NamestringNo

The name of the notification policy.

notificationpolicy_test
PagelongYes

The number of the page to return.

1
SizelongYes

The number of entries to return on each page.

20
IsDetailbooleanNo

Specifies whether to query the details about notification policies. Valid values:

  • true: Details about notification policies are queried.
  • false: Details about notification policies are not queried.
false
RegionIdstringNo

The ID of the region. Default value: cn-hangzhou.

cn-hangzhou
IdsstringNo

The ID of the notification policy.

12345
DirectedModebooleanNo

Specifies whether to enable simple mode.

true

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The ID of the request.

78901766-3806-4E96-8E47-CFEF59E4****
PageBeanobject

The returned pages.

Totallong

The number of notification policies that are returned.

24
Pagelong

The number of the page returned.

1
Sizelong

The number of entries that are returned on each page.

20
NotificationPoliciesarray<object>

The queried notification policies.

policiesobject
Idlong

The ID of the notification policy.

1234
Namestring

The name of the notification policy.

notificationpolicy_test
MatchingRulesarray<object>

The matching rules for alert events.

matchingRulesobject
MatchingConditionsarray<object>

The matching conditions.

matchingConditionsobject
Keystring

The key of the matching condition.

altertname
Valuestring

The value of the matching condition.

test
Operatorstring

The logical operator of the matching condition. Valid values:

  • eq: equal to
  • neq: not equal to
  • in: contains
  • nin: does not contain
  • re: regular expression match
  • nre: regular expression mismatch
eq
SendRecoverMessageboolean

Indicates whether the status of an alert automatically changes to Resolved when all events related to the alert change to the Restored state. The system sends a notification to the alert contacts when the alert status changes to Resolved.

  • true (default): The system sends a notification.
  • false: The system does not send a notification.
true
GroupRuleobject

The grouping rule for alert events.

GroupingFieldsarray

An array of alert event group objects.

  • If you do not specify the groupingFields field, all alerts will be sent to contacts based on alertname.
  • If you specify the groupingFields field, alerts with the same field will be sent to contacts in one notification.
groupingFieldsstring

The field that is used for grouping.

["alertname"]
GroupWaitlong

The waiting time for grouping. Unit: seconds. Default value: 5.

5
GroupIntervallong

The time interval of grouping. Unit: seconds. Default value: 30.

30
NotifyRuleobject

The notification rule.

NotifyStartTimestring

The start time of the notification window.

00:00
NotifyEndTimestring

The end time of the notification window.

23:59
NotifyChannelsarray

The notification method.

notifyChannelsstring

The notification methods. Valid values:

  • dingTalk: DingTalk
  • email: email
  • sms: text message
  • tts: phone call
  • webhook: webhook
[ "dingTalk", "email", "sms", "tts","webhook" ]
NotifyObjectsarray<object>

The notification objects.

notifyObjectsobject
NotifyObjectTypestring

The type of the notification object. Valid values:

  • CONTACT: an individual contact
  • CONTACT_GROUP: a contact group
  • DING_ROBOT: an instant messaging (IM) chatbot
  • CONTACT_SCHEDULE: a person on duty based on an established schedule
CONTACT
NotifyObjectIdlong

The ID of the notification object.

123
NotifyObjectNamestring

The name of the notification object.

test
NotifyChannelsarray

The notification methods specified for a contact.

notifyChannelsstring

The notification methods.

  • email: email
  • sms: text message
  • tts: phone call
[ "email", "sms", "tts" ]
NotifyTemplateobject

The notification template.

EmailTitlestring

The title of the alert notification sent by email.

{{ .commonLabels.alertname }}
EmailContentstring

The content of the alert notification sent by email.

Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels.\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert time: {{ .startTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{if .generatorURL }} \<a href="{{.generatorURL}}" >Link\</a> {{end}} {{end}}
EmailRecoverTitlestring

The title of the alert resolution notification sent by email.

{{ .commonLabels.alertname }}
EmailRecoverContentstring

The content of the alert resolution notification sent by email.

Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels.\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert resolution time: {{ .endTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{if .generatorURL }} \<a href="{{.generatorURL}}" >Link\</a> {{end}} {{end}}
SmsContentstring

The content of the alert notification sent by text message.

\<SmsContent>Notification on the occurrence of a {{ .level }} alert. Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels.\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert time: {{ .startTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{ end }}\</SmsContent>
SmsRecoverContentstring

The content of the alert resolution notification sent by text message.

\<SmsRecoverContent>Alert resolution notification. Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels.\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert resolution time: {{ .endTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{ end }}\</SmsRecoverContent>
TtsContentstring

The content of the alert notification sent by phone.

\<TtsContent>Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels.\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert time: {{ .startTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{ end }}\</TtsContent>
TtsRecoverContentstring

The content of the alert resolution notification sent by phone.

\<TtsRecoverContent>Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels.\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert resolution time: {{ .endTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{ end }}\</TtsRecoverContent>
RobotContentstring

The content of the alert notification sent by an IM chatbot.

{{if .commonLabels.clustername }} > Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels.\_aliyun_arms_involvedObject_kind }} > Application name: {{ .commonLabels.\_aliyun_arms_involvedObject_name }} {{ end }}{{ for .alerts }}> {{.annotations.message}} {{if .generatorURL }} \[Link]\({{.generatorURL}}) {{ end }} {{if eq "true" .labels.\_aliyun_arms_is_denoise_filtered }} (Suspected noise) {{end}} {{end}}
Repeatboolean

Indicates whether the system resends notifications for a long-lasting unresolved alert. Valid values:

  • true (default): The system resends notifications for a long-lasting unresolved alert at a specified time interval.
  • false: The system resends notifications for a long-lasting unresolved alert based on an escalation policy.
true
RepeatIntervallong

The time interval at which a notification is resent for a long-lasting unresolved alert. Unit: seconds.

600
EscalationPolicyIdlong

The ID of the escalation policy.

123
IntegrationIdlong

The integration ID of the ticket system to which alerts are pushed.

34
DirectedModeboolean

Indicates whether simple mode is enabled.

true
Statestring

Indicates whether the notification policy is enabled. Valid values: enable and disable.

enable

Examples

Sample success responses

JSONformat

{
  "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": "Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels.\\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert time: {{ .startTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{if .generatorURL }} \\<a href=\"{{.generatorURL}}\" >Link\\</a> {{end}} {{end}}\n",
          "EmailRecoverTitle": "{{ .commonLabels.alertname }}",
          "EmailRecoverContent": "Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels.\\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert resolution time: {{ .endTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{if .generatorURL }} \\<a href=\"{{.generatorURL}}\" >Link\\</a> {{end}} {{end}}\n",
          "SmsContent": "\\<SmsContent>Notification on the occurrence of a {{ .level }} alert. Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels.\\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert time: {{ .startTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{ end }}\\</SmsContent>\n",
          "SmsRecoverContent": "\\<SmsRecoverContent>Alert resolution notification. Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels.\\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert resolution time: {{ .endTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{ end }}\\</SmsRecoverContent>\n",
          "TtsContent": "\\<TtsContent>Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels.\\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert time: {{ .startTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{ end }}\\</TtsContent>\n",
          "TtsRecoverContent": "\\<TtsRecoverContent>Alert name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels.\\_aliyun_arms_involvedObject_kind }} Application name: {{ .commonLabels.\\_aliyun_arms_involvedObject_name }} {{ end }} Notification policy: {{ .dispatchRuleName }} Alert resolution time: {{ .endTime }} Alert content: {{ for .alerts }} {{.annotations.message}} {{ end }}\\</TtsRecoverContent>\n",
          "RobotContent": "{{if .commonLabels.clustername }} > Cluster name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels.\\_aliyun_arms_involvedObject_kind }} > Application name: {{ .commonLabels.\\_aliyun_arms_involvedObject_name }} {{ end }}{{ for .alerts }}> {{.annotations.message}} {{if .generatorURL }} \\[Link]\\({{.generatorURL}}) {{ end }} {{if eq \"true\" .labels.\\_aliyun_arms_is_denoise_filtered }} (Suspected noise) {{end}} {{end}}\n"
        },
        "Repeat": true,
        "RepeatInterval": 600,
        "EscalationPolicyId": 123,
        "IntegrationId": 34,
        "DirectedMode": true,
        "State": "enable"
      }
    ]
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-06-19The response structure of the API has changedView Change Details
2023-08-17The request parameters of the API has changed. The response structure of the API has changedView Change Details
2023-03-30The response structure of the API has changedView Change Details
2022-02-24Add OperationView Change Details