All Products
Search
Document Center

ApsaraDB for MongoDB:Subscribe to event notifications

Last Updated:Dec 04, 2025

ApsaraDB for MongoDB is integrated with CloudMonitor. You can subscribe to important system events and set alert rules to monitor events and the operational status of your instances in real time.

Background information

CloudMonitor is a service that monitors Alibaba Cloud resources and internet applications. The CloudMonitor alert service provides two types of alert notifications. When a system exception occurs on an Alibaba Cloud product, you can be promptly notified of the event and automatically handle anomalous activity, such as a product failure.

  • Subscribe to events: Use emails, or DingTalk chatbots to send event notifications directly to specified personnel for a quick response.

  • Set alerts: Distribute alerts to your Simple Message Queue, Function Compute, a callback URL, or Simple Log Service. This lets you automate the handling of alerts based on your business scenarios.

Procedure

Subscribe to events

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

  1. Log on to the CloudMonitor console.

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

  3. On the Subscription Policies tab, click Create Subscription Policy.

  4. On the Create Subscription Policy page, configure the parameters for the subscription policy.

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

    • Alert Subscription:

      • Set Subscription Type to System Event.

      • In the Subscription Scope section, if you set Product to ApsaraDB for MongoDB, Event Type to Abnormal, Event Name to Instance Failure Start, and Event Level to Critical, while leaving Application Group, Event Content, and Event Resources unconfigured, you subscribe to the Instance Failure Start system event for all ApsaraDB for MongoDB instances across all application groups under your account.

        Note

        For more information about the system events supported by ApsaraDB for MongoDB, see the Cloud Monitor event list.

    • Combined Noise Reduction: Use the default values.

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

      When you 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 more information, see Manage notification configurations.

      The system automatically sends alert notifications based on the notification methods specified for the alert contacts in the alert contact group. For example, if a mobile number and an email address are specified for an alert contact and Custom Notification Method is set to the default method, the alert contact receives alert notifications by phone call, text message, and email.

    • Push and Integration: No configuration is required.

      Note

      For more information, see Manage Push Channels.

    Table 1. Subscription policy parameters

    Section

    Parameter

    Description

    Basic Information

    Name

    The name of the subscription policy.

    Description

    The description of the subscription policy.

    Alert Subscription

    Subscription Scope

    The type of 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 must set the subscription scope for system events, including the following: Product, Event Type, Event Name, Event Level, Application Group, Event Content, and Event Resource.

      • Event Content: Refers to the fields within the `content` section of the event details. The input box performs a containment match for keywords. To enter multiple keywords, separate them with a comma (,). In whitelist mode, a match occurs if any keyword is found. In blacklist mode, all keywords must be matched. For example, in whitelist mode, if you enter `re,1754xxxxx651403` in the Event Content field, all events containing either `re` or `1754xxxxx651403` are filtered.

        "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 Resource: The ResourceId of the cloud product, for example, acs:ecs:cn-shanghai:{uid}:instance/{instanceId}. The input box performs a containment match for keywords. To enter multiple keywords, separate them with a comma (,). In whitelist mode, a match occurs if any keyword is found. In blacklist mode, all keywords must be matched. For example, in whitelist mode, if you enter instanceId_1,instanceId_2 in the Event Resource field, events with an instance ID of either `instanceId_1` or `instanceId_2` are filtered.

    • Threshold Event: When an alert rule for a threshold is met, a threshold event is also triggered in CloudMonitor. By subscribing to threshold events, you can have fine-grained control and customization over alert notifications, such as merging, denoising, and custom notification methods. You must set the subscription scope for threshold events, including the following: Product Category, Monitoring Metrics, Severity Level, and Application Group.

    Combined Noise Reduction

    Note

    If you do not set a merge rule, all alerts accepted by the subscription policy are merged by default.

    Merge Content

    Select the dimensions for merging from the Subscription Scope of the selected Subscription Type.

    Noise Reduction

    Reduces the frequency of alert notifications. The options are:

    • Conditional trigger, suppress after trigger: If a notification is triggered a specific number of times (default: 5) within a certain period (default: 5 minutes), a mute period (default: 5 minutes) is entered. No further notifications are sent during the mute period. The process repeats after the mute period ends.

    • Direct trigger, suppress after trigger: A notification is sent immediately when an alert is triggered. Then, a mute period (default: 5 minutes) is entered. No further notifications are sent during the mute period. The process repeats after the mute period ends.

    • Direct trigger, no suppression (uses default anti-storm settings): A notification is sent immediately when an alert is triggered.

    Notifications

    Notification Configuration

    When a system event or threshold event meets the alert conditions, notify the alert contacts directly or notify different alert contacts based on the alert level.

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

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

    Custom Notification Method

    Customize the alert notification method.

    Click Modify next to a notification method to change the Notification Template and Alert Level.

    Push and Integration

    Push Channel

    The push channel for alert notifications. To create a push channel, perform the following steps:

    1. Click Create New Push.

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

      For more information about how to set the parameters for a push channel, see Manage Push Channels.

  5. Click Submit.

  6. Debug the event subscription.

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

    2. In the Create Event Debugging 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.

      The system displays the Operation Successful message. CloudMonitor automatically sends a test alert notification to the alert contacts based on the notification method in the subscription policy.

Set alerts

  1. Log on to the MongoDB console.

  2. In the navigation pane on the left, click Replica Set Instances or Sharded Cluster Instances based on your instance type.

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

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

  5. In the navigation pane on the left, click Alert Rules.

  6. In the upper-left corner of the page, click Set Alert Rule. You are redirected to the CloudMonitor console.

  7. In the CloudMonitor console, configure a threshold-triggered alert rule for the ApsaraDB for MongoDB instance.

    1. On the Alert Rules page, click Create Alert Rule.

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

      Parameter

      Description

      Product

      The Alibaba Cloud service that you want to monitor.

      Based on the instance type, select ApsaraDB For MongoDB - Standalone Instance, ApsaraDB For MongoDB - Replica Set, or ApsaraDB For MongoDB - Sharded Cluster.

      Resource Range

      The resources to which the alert rule applies. Valid values are:

      • All Resources: The alert rule applies to all resources of the specified cloud service.

        For example, you can set an alert that is triggered when the CPU utilization of any MongoDB instance under your account exceeds 80%. If you select All Resources, an alert notification is sent whenever this condition is met. When you select All Resources, the rule applies to a maximum of 1,000 resources. If you have more than 1,000 resources, alerts may not be triggered when the threshold is reached. In this case, you can use application groups to organize resources by business before you set alerts.

      • Application Groups: The alert rule applies to all resources in a specified application group of the specified cloud service.

      • Instances: The alert rule applies to a specified resource of the specified cloud service.

        For example, if you set an alert to be triggered when the host CPU utilization of an instance exceeds 80%, an alert notification is sent when this condition is met.

      Rule Description

      The conditions that trigger the alert rule. The alert rule is triggered when monitoring data meets these conditions. Configure the rule description by following these steps:

      1. Click Add Rule.

      2. In the Configure Rule Description panel, set the rule name, metric type, metric, threshold, and alert level.

      3. Click OK.

      Note

      You can click Add Rule to configure multiple alert rules. The supported metrics vary based on the MongoDB instance type. For more information, see the following topics:

      Mute Period

      The period for which new alert notifications are suppressed after an initial alert is sent. If the alert condition persists after the mute period, another alert notification is sent. Valid values: 5 minutes, 15 minutes, 30 minutes, 60 minutes, 3 hours, 6 hours, 12 hours, and 24 hours.

      When a metric reaches its threshold, an alert is sent. If the metric continues to exceed the threshold during this mute period, no more alerts are sent. If the metric has not returned to a normal state after the mute period ends, CloudMonitor sends another alert notification.

      Effective Period

      The time period during which the alert rule is active. CloudMonitor monitors data and sends alerts only during this period.

      Alert Contact Group

      The contact group to which alert notifications are sent.

      Alert notifications are sent to the contacts in the specified alert contact group. An alert contact group can contain one or more alert contacts.

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

      Tag

      The tag of the alert rule. A tag consists of a tag key and a tag value.

      Alert Callback

      A public URL that can receive alert notifications from CloudMonitor through POST requests. Only the HTTP protocol is supported. For more information about how to configure an alert callback, see Use the alert callback feature to send notifications for threshold-triggered alerts.

      Note

      Click Advanced Settings to configure this parameter.

      Auto Scaling

      If you enable Auto Scaling, the corresponding scaling rule is triggered when an alert is generated. You must set the Region, ESS Group, and ESS Rule parameters.

      Note

      Click Advanced Settings to configure this parameter.

      Log Service

      If you enable Log Service, alert information is written to the specified Logstore in Simple Log Service when an alert is generated. You must set the Region, ProjectName, and Logstore parameters.

      For more information about how to create a project and a Logstore, see Quick start: Use Logtail to collect and analyze ECS text logs.

      Note

      Click Advanced Settings to configure this parameter.

      Simple Message Queue (formerly MNS) — Topic

      If you enable Simple Message Queue (formerly MNS) — Topic, alert information is written to the specified topic in Simple Message Queue when an alert is generated. You must set the region and topic.

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

      Note

      Click Advanced Settings to configure this parameter.

      Function Compute

      If you enable Function Compute, alert notifications are sent to Function Compute for format processing when an alert is generated. You must set the region, service, and function.

      For more information about how to create a service and a function, see Quickly create a function.

      Note

      Click Advanced Settings to configure this parameter.

      No Data Processing

      The method for handling alerts when monitoring data is not found. Valid values are:

      • Do Not Take Any Action (default)

      • Send No-data Alerts

      • Consider As Recovered

      Note

      Click Advanced Settings to configure this parameter.

    3. Click Confirm.

      After the rule is created, you can view it on the alert rules page in the CloudMonitor console or on the alert rules page in the MongoDB console.

Related API operations

CloudMonitor API operations

Description

PutEventRule

Creates or modifies an alert rule for an event.