Notification policies

更新时间:
复制 MD 格式

Notification policies define the conditions under which alert notifications are sent. When an alert event meets these conditions, the system notifies the specified recipients, prompting them to take action.

Prerequisites

You must create a contact before you can add it to a notification policy. For more information, see Create a contact.

Create a notification policy

  1. Log on to the Managed Service for Prometheus console. In the left navigation pane, choose Alert Management > Notification Policies.

  2. On the Notification Policies page, click Create Notification Policy.

  3. On the Create Notification Policy page, enter a name for the policy.

  4. In the Matching Rule section, define the conditions an alert event must meet to trigger this policy.

    Important

    A silence policy takes precedence over a notification policy. Alert events that match a silence policy are suppressed and are not evaluated against any notification policy. For more information, see Silence policy.

    1. Select a data source.

      • Specified source: The notification policy processes alert events only from the selected integration.

      • No preset source: The notification policy processes all alert events, regardless of their source.

    2. Define one or more matching expressions by using tags. You can specify custom tags or use existing tags.

      Existing tags include:

      • Tags included in the alert rule expression. To learn how to create tags for an alert rule in Managed Service for Prometheus, see Create a Prometheus alert rule.

      • Default tags provided by Application Real-Time Monitoring Service (ARMS). The following table describes the default tags.

        Category

        Tag

        Description

        Common fields

        alertname

        The alert name.

        clustername

        The cluster name.

        severity

        The severity. Valid values:

        • P1

        • P2

        • P3

        • P4

        • Default

        namespace

        The namespace.

        pod_name

        The Pod name.

        System-preset fields

        _aliyun_arms_integration_name

        The name of the integration. The default integration name for alerts reported by ARMS is ARMS-DEFAULT.

        _aliyun_arms_involvedObject_id

        The ID of the object that triggered the alert.

        _aliyun_arms_involvedObject_name

        The name of the object that triggered the alert.

        _aliyun_arms_region_id

        The region ID.

        _aliyun_arms_alert_rule_id

        The ID of the alert rule.

        _aliyun_arms_alert_type

        The type of alert rule. Valid values:

        • 101: Prometheus alert

        • 5: Application Monitoring alert

        • 4: Browser Monitoring alert

      Note
      • To add a condition using AND logic, click Add Condition within the same rule.

      • To add a new rule using OR logic, click Add Rule.

      • The total size of all rule descriptions in a notification policy cannot exceed 64 KB. This is approximately 100 matching rules, but the exact number depends on the complexity of each rule. If you exceed this limit, the configuration fails. In this case, create a new notification policy for the additional rules.

    3. Click Next.

  5. In the Event Group section, configure how to group alert events into notifications, and then click Next.

    • No grouping: All matching alert events are sent in a single notification.

    • Group by field: Alert events with the same values in the specified fields are grouped into a single notification.

  6. In the Notification Objects section, configure the following parameters.

    1. Click +Add notification object to select one or more recipients.

      Recipient types include:通知策略-当告警生成时

      • Contact: An individual contact. You must select a notification method: phone call, SMS message, or email.

      • Contact group: A group of contacts. You must select a notification method: phone call, SMS message, or email.

      • Shift: An on-call schedule. You must select a notification method: phone call, SMS message, or email.

      • DingTalk/Lark/WeCom: A DingTalk, Lark, or WeCom messaging channel.

      • Webhook: A custom webhook endpoint.

    2. Configure whether to send a notification when an alert is resolved.

      Send resolution notification: If you enable this option, the system automatically sets the alert status to Resolved after all related events are cleared and then sends a resolution notification to the specified recipients.

    3. Select a notification template. For more information, see Configure notification templates and webhook templates.

    4. Set the time window during which notifications are sent.

    5. Optional: Select a ticket system integration to automatically create tickets from alerts. For more information, see Integrations.

    6. Click Next.

  7. In the Repeat/escalation/recovery policy section, configure policies for unresolved alerts. You can set up repeat notifications, apply an escalation policy, or require manual recovery. Then, click Next.

    • If you do not configure an escalation policy, the system sends only one notification for an unresolved alert.

    • Repeat notifications: Set a frequency. If an alert is not resolved, notifications are resent at the specified interval until the alert is resolved.

    • Escalation policy: Select a policy. If an alert is not resolved, the system sends notifications to additional recipients according to the selected escalation policy.

    • Manual recovery: If you enable this option, an alert does not automatically resolve even if no new alert events are triggered within the automatic resolution period defined in the alert integration. You must manually change the alert status.

  8. In the Action Integration section, configure an action integration to run automatically.

    If you enable this option, you must select the action integrations to run when an alert is triggered and when it is resolved. The system will then run them automatically.

  9. After you complete the configuration, click Save.

Manage notification policies

After a notification policy is created, it is displayed on the Notification Policies page. You can perform the following operations on the Notification Policies page:

  • To edit a notification policy, click the policy name or click Actions in the Edit column. After you modify the settings, click Save.

  • To enable or disable a notification policy, toggle the switch in the Status column.

  • To delete a notification policy, click Actions in the Delete column, and then click Confirm in the confirmation dialog box.

  • To duplicate a notification policy, click Actions in the Copy column.