Subscribe to event notifications

更新时间:
复制 MD 格式

ApsaraDB for MongoDB integrates with CloudMonitor, letting you monitor instance health and respond to anomalies in real time by subscribing to key system events and setting alert rules.

Background information

Its alerting service helps you handle system exceptions, such as a cloud service outage, by notifying you promptly and enabling automated responses. It provides the following capabilities:

  • Subscribe to events: Delivers event notifications to specified personnel via text messages, email, or DingTalk chatbots, enabling a rapid response.

  • Set alert rules: Routes alerts to Simple Message Queue, Function Compute, URL callbacks, and Log Service to automate exception handling based on your business scenarios.

Procedure

Subscribe to events

This section uses the Instance Failure Start system event for ApsaraDB for MongoDB as an example to demonstrate how to subscribe to events.

  1. Log on to the CloudMonitor console.

  2. In the left-side navigation pane, choose Event Center > Event Subscription.

  3. On the Subscription Policies tab, click Create a subscription policy.

  4. On the Create a subscription policy page, configure the subscription policy parameters.

    • Basic Infomation: Enter a name for the subscription policy.

    • Alert subscription:

      • Set Subscription Type to System Event.

      • In the Subscription Scope section, set Product to ApsaraDB for MongoDB, Event Type to Exception, Event Name to Instance Failure Start, and Event Level to Critical. Leave Application Groups, Event Content, and Event Resources empty. This configuration subscribes you to the Instance Failure Start system event for all ApsaraDB for MongoDB instances in all application groups under your account.

        Note

        For a list of system events supported by ApsaraDB for MongoDB, see the CloudMonitor event list.

    • Merge & denoise: Use the default settings.

    • Notification: Create a notification configuration. For Custom Notification Method, use the default notification method.

      To create a notification configuration, enter a name for the configuration, set Notification Settings to Directly Set Notification Group, select an alert Contact Group, and then click OK.

      Note

      For information about how to create a notification configuration, see Manage notification configurations.

      For example, if you specify a mobile number and an email address for an alert contact and you use the default notification method for Custom Notification Method, the contact receives only alert calls, text messages, and emails.

    • Push & integration: No configuration is required.

      Note

      For information about how to create a push channel, see Manage push channels.

    Table 1. Subscription policy parameters

    Section

    Parameter

    Description

    Basic Infomation

    Name

    The name of the subscription policy. We recommend that you use a Chinese name.

    Description

    The description of the subscription policy.

    Alert subscription

    Subscription Type

    The type of the alert subscription. Valid values:

    • System Event: System events include failure and O&M events for various cloud products. By subscribing to system events, you can receive notifications or trigger external systems when events occur. You need to configure the subscription scope for system events, which includes Product, Event Type, Event Name, Event Level, application group, Event Content, and Event Resources.

      • Event Content: Refers to the fields within the content object in the event details. The system performs a keyword match. To enter multiple keywords, separate them with a comma (,). In whitelist mode, an event matches if it contains any specified keyword. In blacklist mode, an event matches only if it contains all specified keywords. For example, if you enter re,1754xxxxx651403 in whitelist mode, the system matches events that contain either re or 1754xxxxx651403.

        "content": {"invokeId": "t-bj05sxXXXXXXa5xq8","repeats": 1,"finishTime": "2025-08-05T17:07:17Z","commandName": "cmd-2025-08-06","instanceId": "i-2ze61xxxxxugk0zoh7","repeatMode": "Once","playerUid": 1754xxxxx651403,"exitCode": 0,"startTime": "2025-08-05T17:07:14Z","ownerId": 18250xxxxx44564,"commandId": "c-bj05sxxxxxxog00","invocationStatus": "Success"}
      • Event Resources: The resource of the event, which corresponds to the resource ID (ARN) of the cloud product, for example, acs:ecs:cn-shanghai:{uid}:instance/{instanceId}. The system performs a keyword match. To enter multiple keywords, separate them with a comma (,). In whitelist mode, an event matches if it contains any specified keyword. In blacklist mode, an event matches only if it contains all specified keywords. For example, if you enter instanceId_1,instanceId_2 in whitelist mode, the system matches events for instances with the ID instanceId_1 or instanceId_2.

    • Threshold Event: When a threshold-based alert rule meets its condition, CloudMonitor also triggers a threshold event. Subscribing to these events gives you fine-grained control over alert notifications, such as using noise reduction and custom notification methods. You must configure the subscription scope for threshold events, which includes Product Category, Metric, Severity, and application group.

    Merge & denoise

    Note

    If you do not configure merge rules, all alerts accepted by the subscription policy are merged by default.

    Merge content

    Select a merge dimension from the Subscription Scope settings for the selected Subscription Type.

    Denoise

    Reduces the frequency of alert notifications. The following options are available:

    • Conditional trigger, suppress after trigger: If an alert triggers a specified number of times (default: 5) within a specified period (default: 5 minutes), a mute period (default: 5 minutes) begins. During the mute period, the system sends no further notifications. After the mute period ends, this cycle repeats.

    • Direct trigger, suppress after trigger: The system sends a notification immediately after an alert triggers. Then, a mute period (default: 5 minutes) starts. During the mute period, the system sends no further notifications. After the mute period ends, this cycle repeats.

    • Direct trigger, no suppression (use system default anti-storm settings): The system sends a notification immediately after an alert triggers.

      Note

      The default anti-storm rules are as follows:

      • Text message: 5 messages per 2 minutes.

      • Phone call: 3 calls per 2 minutes.

      • Email: Up to 50 emails per 5 minutes.

    Notification

    Notification Configurations

    When a system event or threshold event meets the alert conditions, CloudMonitor sends notifications directly to alert contacts or to different contacts based on the alert level.

    You can select an existing notification configuration or click Create Notification Configuration to create a new one.

    For information about how to set parameters for a notification configuration policy, see Manage notification configurations.

    Custom notification method

    A custom method for sending alert notifications.

    Click Edit next to a notification method to change the Notification Templates and Alert Level.

    Push & integration

    Push channel

    The channel for pushing alert notifications. To create a push channel, follow these steps:

    1. Click Create New Push.

    2. Select an existing push channel or click Add Channel to create a new one.

      For information about how to set parameters for a push channel, see Manage push channels.

  5. Click Submit.

  6. Debug the event subscription.

    1. On the Subscription Policies tab, click Debug Event Subscription.

    2. In the Create Event Test panel, set Product to ApsaraDB for MongoDB and Name to Instance Failure Start.

      The system automatically generates the debugging content in JSON format.

    3. Click OK.

      If the Operation Successful message appears, CloudMonitor automatically sends a test alert to the alert contacts based on the notification methods in the subscription policy.

Set alert rules

  1. Create an alert contact or an alert contact group. For more information, see Create an alert contact or an alert contact group.

  2. Log on to the ApsaraDB for MongoDB console.

  3. In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances, depending on your instance type.

  4. In the upper-left corner, select the resource group and region of the instance.

  5. Click the ID of the target instance, or click Manage in the Actions column.

  6. Set event alerts.

    1. In the left-side navigation pane of the instance details page, click Alert Rules.

    2. Click Set Alert Rule to go to the CloudMonitor console.

    3. Click Create Alert Rule.

    4. In the Create Alert Rule panel, configure the following parameters.

      Parameter

      Description

      Product

      No change is required. The system automatically sets this to the type of the current instance.

      Resource scope

      The alert rule applies to the specified resources of the specified cloud service. The default value is Instance.

      Related Resource

      No change is required. The system automatically sets this to the ID of the current instance.

      Rule Description

      The core of the alert rule. An alert triggers when monitoring data meets the specified condition. To configure the rule description, follow these steps:

      1. Click Add Rule.

      2. In the Configure Rule Description panel, enter a Rule Name and then set the Metric Type.

        • Single Metric: Select a metric and then set a threshold and an alert level.

        • Multiple Metrics: Select an alert level and then configure alert conditions for two or more metrics.

        • Dynamic Threshold: For more information about intelligent thresholds, see Overview and Create an intelligent threshold alert rule.

      3. Click OK.

      Note

      For information about how to configure complex alert conditions, see Alert rule expressions.

      Mute Period

      The interval before CloudMonitor sends a new notification for an unresolved alert. Valid values: 5 Minutes, 15 Minutes, 30 Minutes, 60 Minutes, 3 Hours, 6 Hours, 12 Hours, and 24 Hours.

      When a metric reaches the alert threshold, CloudMonitor sends a notification. If the metric remains above the threshold during the mute period, CloudMonitor sends no new notifications. If the alert remains unresolved after the mute period ends, CloudMonitor sends another notification.

      For example, if you set Mute Period to 12 Hours, CloudMonitor sends another notification after 12 hours if the alert remains unresolved.

      Effective Period

      The time window during which the alert rule is active. CloudMonitor sends alert notifications only during this period.

      Note

      When an alert rule is outside its effective period, it does not send notifications, but its alert history still appears in the Alert History list.

      Alert Contact Group

      The contact group that receives alerts.

      CloudMonitor sends alerts for an application group to the contacts in this alert contact group. An alert contact group can contain one or more alert contacts.

      For information about how to create alert contacts and alert contact groups, see Create an alert contact or an alert contact group.

      Tags

      Tags for the alert rule, each consisting of a tag key and a tag value.

      Note

      You can add a maximum of six tags.

      Alert Callback

      A publicly accessible URL that receives alert information from CloudMonitor via POST requests. This feature supports only the HTTP protocol. For information about how to configure an alert callback, see Use a threshold-triggered alert callback.

      To test the connectivity of the alert callback URL, follow these steps:

      1. Click Test to the right of the callback URL.

        In the Webhook Test panel, use the webhook status code and test result details to validate and troubleshoot connectivity.

        Note

        You can also set the webhook's Callback template type and Language, and then click Test again to obtain the corresponding test result details.

      2. Click Close.

      Note

      Click Advanced Settings to configure this parameter.

      Auto Scaling

      If you enable the Auto Scaling switch, an alert triggers the corresponding scaling rule. You must set the Region, ESS Group, and ESS Rule for Auto Scaling.

      Note

      Click Advanced Settings to configure this parameter.

      Simple Log Service

      If you enable the Simple Log Service switch, CloudMonitor sends alert information to a Logstore in Log Service when an alert occurs. You must set the Region, ProjectName, and Logstore for Log Service.

      For information about how to create a project and a Logstore, see Use Logtail to collect and analyze text logs from ECS instances.

      Note

      Click Advanced Settings to configure this parameter.

      Simple Message Queue (MNS) Topic

      If you enable the Simple Message Queue (MNS) Topic switch, alert information is sent to a topic in Simple Message Queue when an alert occurs. You must set the region and topic for Simple Message Queue.

      For information about how to create a topic, see Create a topic.

      Note

      Click Advanced Settings to configure this parameter.

      Function Compute

      If you enable the Function Compute switch, CloudMonitor sends alert notifications to Function Compute for processing when an alert occurs. You must set the region, service, and function for Function Compute.

      For information about how to create services and functions, see Create a function.

      Note

      Click Advanced Settings to configure this parameter.

      Method to handle alerts when no monitoring data is found

      Specifies how to handle an alert when no monitoring data is available. Valid values:

      • Do not do anything (default)

      • Send alert notifications

      • Treated as normal

      Note

      Click Advanced Settings to configure this parameter.

    5. Click OK.

API reference

CloudMonitor API

Description

PutEventRule

Creates or modifies an event alert rule.