All Products
Search
Document Center

ApsaraDB for MongoDB:Subscribe to event notifications

Last Updated:Mar 28, 2026

ApsaraDB for MongoDB integrates with CloudMonitor so you can monitor instance health and respond to anomalies in real time. CloudMonitor supports two complementary approaches:

ApproachTriggerDelivery targetsBest for
Subscribe to eventsA discrete system event occurs (for example, an instance failure starts)Email, DingTalk chatbotImmediate human notification for failure and maintenance events
Set alert rulesA metric crosses a threshold you define (for example, CPU utilization exceeds 80%)Simple Message Queue, Function Compute, a callback URL, Simple Log ServiceAutomated handling of continuous metric anomalies

Use event subscriptions to react to discrete failure or maintenance events. Use alert rules to monitor continuous metrics and integrate with automation systems.

Prerequisites

Before you begin, make sure you have:

Procedure

Subscribe to events

The following steps use the Instance Failure Start system event as an example. The same procedure applies to any system event supported by ApsaraDB for MongoDB. For a full list of supported events, see the CloudMonitor event list.

  1. Log on to the CloudMonitor console.

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

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

  4. On the Create Subscription Policy page, configure the following sections: Basic information Enter a name for the subscription policy. Alert subscription Set Subscription Type to System Event, then configure the subscription scope: Leaving Application Group, Event Content, and Event Resources blank subscribes to the Instance Failure Start event for all ApsaraDB for MongoDB instances across your account. Combined noise reduction Keep the default values. If you do not configure a merge rule, all alerts accepted by the subscription policy are merged by default. The three noise reduction modes are: Notifications Create or select a notification configuration: CloudMonitor sends alerts using the contact methods (phone call, text message, email) configured for each contact in the group. To use a custom delivery method, click Modify next to a notification method and update the Notification Template and Alert Level. For more information, see Manage notification configurations. Push and integration No configuration required. To route alerts to external systems, click Create New Push and select or create a push channel. For more information, see Manage push channels.

    • Conditional trigger, suppress after trigger — If an alert fires a specific number of times (default: 5) within a set period (default: 5 minutes), a mute period (default: 5 minutes) begins. No further notifications are sent during the mute period.

    • Direct trigger, suppress after trigger — A notification is sent immediately when an alert fires, then a mute period (default: 5 minutes) begins.

    • Direct trigger, no suppression — A notification is sent immediately every time an alert fires (uses default anti-storm settings).

    1. Click Create Notification Configuration.

    2. Enter a name for the configuration.

    3. Set Notification Settings to Directly Set Notification Group.

    4. Select an alert Contact Group.

    5. Click OK.

    Event Content and Event Resources both use a containment match. Separate multiple keywords with a comma (,). In whitelist mode, an event matches if any keyword is found. In blacklist mode, all keywords must match.
    ParameterExample valueDescription
    ProductApsaraDB for MongoDBThe cloud service to monitor.
    Event TypeAbnormalThe category of event.
    Event NameInstance Failure StartThe specific event to subscribe to.
    Event LevelCriticalThe severity level.
    Application Group(leave blank)Leave blank to cover all instances under your account.
    Event Content(leave blank)Leave blank to match all events, or enter keywords for filtering. Keywords are matched against the fields within the content section of the event details.
    Event Resources(leave blank)Leave blank to match all resources, or enter a ResourceId for filtering (for example, acs:ecs:cn-shanghai:{uid}:instance/{instanceId}).
  5. Click Submit.

Test the subscription

Before a real incident occurs, verify that your notification chain is working correctly:

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

  2. In the Create Event Debugging panel, set Product to ApsaraDB for MongoDB and Name to Instance Failure Start. CloudMonitor automatically generates the debugging content in JSON format.

  3. Click OK.

CloudMonitor sends a test alert to all contacts in the subscription policy's notification configuration. If the operation succeeds, you see an Operation Successful message.

Set alert rules

Alert rules trigger when a monitored metric crosses a threshold you define. You configure them from the MongoDB console, which redirects to CloudMonitor.

  1. Log on to the MongoDB console.

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

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

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

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

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

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

  8. In the Create Alert Rule panel, configure the following parameters:

    ParameterDescription
    ProductThe instance type to monitor. Select ApsaraDB For MongoDB - Standalone Instance, ApsaraDB For MongoDB - Replica Set, or ApsaraDB For MongoDB - Sharded Cluster based on your instance type.
    Resource RangeThe resources to which the alert rule applies: All Resources, Application Groups, or Instances. 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, organize instances into application groups first, then set rules at the group level.
    Rule DescriptionThe metric conditions that trigger the alert. Click Add Rule, configure the rule name, metric type, metric, threshold, and alert level in the Configure Rule Description panel, then click OK. Add multiple rules if needed. For supported metrics, see Metrics for standalone instances, Metrics for replica set instances, and Metrics for sharded cluster instances.
    Mute PeriodHow long to suppress follow-up notifications after an initial alert fires. Valid values: 5 minutes, 15 minutes, 30 minutes, 60 minutes, 3 hours, 6 hours, 12 hours, 24 hours. If the metric is still above the threshold after the mute period ends, CloudMonitor sends another notification.
    Effective PeriodThe time window during which the alert rule is active. CloudMonitor only evaluates metrics and sends alerts within this period.
    Alert Contact GroupThe contact group to receive alert notifications. A group can contain one or more contacts.
    TagA tag key-value pair to label the alert rule.
    Alert Callback(Advanced Settings) A public URL that receives alert notifications from CloudMonitor via HTTP POST.
    Auto Scaling(Advanced Settings) When enabled, triggers the specified scaling rule when an alert fires. Requires Region, ESS Group, and ESS Rule. See Configure scaling groups and Configure scaling rules.
    Log Service(Advanced Settings) When enabled, writes alert details to the specified Logstore in Simple Log Service when an alert fires. Requires Region, ProjectName, and Logstore.
    Simple Message Queue (formerly MNS) — Topic(Advanced Settings) When enabled, writes alert details to the specified topic in Simple Message Queue when an alert fires. Requires region and topic.
    Function Compute(Advanced Settings) When enabled, sends alert notifications to Function Compute for processing when an alert fires. Requires region, service, and function.
    No Data Processing(Advanced Settings) How to handle alerts when no monitoring data is found. Options: Do Not Take Any Action (default), Send No-data Alerts, or Consider As Recovered.
  9. Click Confirm.

After the rule is created, view and manage it on the alert rules page in either the CloudMonitor console or the MongoDB console.

API reference

OperationDescription
PutEventRuleCreates or modifies an event alert rule in CloudMonitor.

What's next