All Products
Search
Document Center

Application Real-Time Monitoring Service:ListNotificationPolicies

Last Updated:May 09, 2024

Queries notification policies based on specified conditions.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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:ListDispatchRuleWrite
  • 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.

cn-hangzhou
IdsstringNo

The ID of the notification policy.

12345
DirectedModebooleanNo

Specifies whether to enable simple mode.

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
NotificationPoliciesobject []

The queried notification policies.

Idlong

The ID of the notification policy.

1234
Namestring

The name of the notification policy.

notificationpolicy_test
MatchingRulesobject []

The matching rules for alert events.

MatchingConditionsobject []

The matching conditions.

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

The fields that are used to group events.

  • If this parameter is not returned, all alert notifications are sent to the alert contacts that belong to the alertname group. By default, this parameter is not returned.
  • If this parameter is returned, alerts with the same fields are sent to the alert contacts in one notification.
string

The field that is used to group events.

["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 rules.

NotifyStartTimestring

The start time of the notification window.

00:00
NotifyEndTimestring

The end time of the notification window.

23:59
NotifyChannelsarray

The notification methods.

string

The notification methods. Valid values:

  • dingTalk: DingTalk
  • email: email
  • sms: text message
  • tts: phone call
  • webhook: webhook
[ "dingTalk", "email", "sms", "tts","webhook" ]
NotifyObjectsobject []

The notification objects.

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.

string

The notification methods. Valid values:

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

The notification templates.

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 }} App Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} Notification Policy: {{ .dispatchRuleName }} Alert Time: {{ .startTime }} Description: {{ for .alerts }} {{ .annotations.message }} {{if .generatorURL }} <a href="{{.generatorURL}}" > Details</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 }} App Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} Notification Policy: {{ .dispatchRuleName }} Recover Time: {{ .endTime }} Description: {{ for .alerts }} {{ .annotations.message }} {{if .generatorURL }} <a href="{{.generatorURL}}" > Details</a> {{ end }} {{ end }}
SmsContentstring

The content of the alert notification sent by text message.

{{ .level }}Alert Occurs Alert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} App Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} Notification Policy: {{ .dispatchRuleName }} Alert Time: {{ .startTime }} Description: {{ for .alerts }} {{ .annotations.message }} {{ end }}
SmsRecoverContentstring

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

Alert Recovery Notification Alert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} App Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} Notification Policy: {{ .dispatchRuleName }} Recover Time: {{ .endTime }} Description: {{ for .alerts }} {{ .annotations.message }} {{ end }}
TtsContentstring

The content of the alert notification sent by phone.

Alert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} App Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} Notification Policy: {{ .dispatchRuleName }} Alert Time: {{ .startTime }} Description: {{ for .alerts }} {{ .annotations.message }} {{ end }}
TtsRecoverContentstring

The content of the alert resolution notification sent by phone.

Alert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }} Cluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }} App Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }} Notification Policy: {{ .dispatchRuleName }} Recover Time: {{ .endTime }} Description: {{ for .alerts }} {{ .annotations.message }} {{ end }}
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 }} > App Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}{{ for .alerts }} > {{ .annotations.message }} {{if .generatorURL }} [Details]({{.generatorURL}}) {{end}} {{if .annotations._aliyun_arms_insights_analyze_link }}[<font color='#ff0000'>diagnostic analysis</font>]({{ .annotations._aliyun_arms_insights_analyze_link}}){{ end }}{{if eq "1" .labels._aliyun_arms_denoise_code }} (Important:{{.labels._aliyun_arms_important_reason }}) {{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 notifications are 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.

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 }}\nCluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\nApp Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}\nNotification Policy: {{ .dispatchRuleName }}\nAlert Time: {{ .startTime }}\nDescription: {{ for .alerts }} {{ .annotations.message }}  {{if .generatorURL }}  <a href=\"{{.generatorURL}}\" > Details</a>\n {{ end }} {{ end }}",
          "EmailRecoverTitle": "{{ .commonLabels.alertname }}",
          "EmailRecoverContent": "Alert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }}\nCluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\nApp Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}\nNotification Policy: {{ .dispatchRuleName }}\nRecover Time: {{ .endTime }}\nDescription: {{ for .alerts }} {{ .annotations.message }}  {{if .generatorURL }} <a href=\"{{.generatorURL}}\" > Details</a>\n {{ end }} {{ end }}",
          "SmsContent": "{{ .level }}Alert Occurs\nAlert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }}\nCluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\nApp Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}\nNotification Policy: {{ .dispatchRuleName }}\nAlert Time: {{ .startTime }}\nDescription: {{ for .alerts }} {{ .annotations.message }} {{ end }}",
          "SmsRecoverContent": "Alert Recovery Notification\nAlert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }}\nCluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\nApp Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}\nNotification Policy: {{ .dispatchRuleName }}\nRecover Time: {{ .endTime }}\nDescription: {{ for .alerts }} {{ .annotations.message }} {{ end }}",
          "TtsContent": "Alert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }}\nCluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\nApp Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}\nNotification Policy: {{ .dispatchRuleName }}\nAlert Time: {{ .startTime }}\nDescription: {{ for .alerts }} {{ .annotations.message }} {{ end }}",
          "TtsRecoverContent": "Alert Name: {{ .commonLabels.alertname }}{{if .commonLabels.clustername }}\nCluster Name: {{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\nApp Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}\nNotification Policy: {{ .dispatchRuleName }}\nRecover Time: {{ .endTime }}\nDescription: {{ for .alerts }} {{ .annotations.message }} {{ end }}",
          "RobotContent": "{{if .commonLabels.clustername }}\n\n >  Cluster Name: {{ .commonLabels.clustername }} \n\n {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\n\n >  App Name: {{ .commonLabels._aliyun_arms_involvedObject_name }} \n\n {{ end }}{{ for .alerts }} >  {{ .annotations.message }} {{if .generatorURL }} [Details]({{.generatorURL}})  {{end}} {{if .annotations._aliyun_arms_insights_analyze_link }}[<font color='#ff0000'>diagnostic analysis</font>]({{ .annotations._aliyun_arms_insights_analyze_link}}){{ end }}{{if  eq \"1\" .labels._aliyun_arms_denoise_code }} (Important:{{.labels._aliyun_arms_important_reason }}) {{end}}\n\n{{end}}"
        },
        "Repeat": true,
        "RepeatInterval": 600,
        "EscalationPolicyId": 123,
        "IntegrationId": 34,
        "DirectedMode": true
      }
    ]
  }
}

Error codes

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

Change history

Change timeSummary of changesOperation
2023-08-17The request parameters of the API has changed. The response structure of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: DirectedMode
Output ParametersThe response structure of the API has changed.
2023-03-30The response structure of the API has changedsee changesets
Change itemChange content
Output ParametersThe response structure of the API has changed.
2022-02-24Add Operationsee changesets