ApsaraDB for MongoDB integrates with CloudMonitor so you can monitor instance health and respond to anomalies in real time. CloudMonitor supports two complementary approaches:
| Approach | Trigger | Delivery targets | Best for |
|---|---|---|---|
| Subscribe to events | A discrete system event occurs (for example, an instance failure starts) | Email, DingTalk chatbot | Immediate human notification for failure and maintenance events |
| Set alert rules | A metric crosses a threshold you define (for example, CPU utilization exceeds 80%) | Simple Message Queue, Function Compute, a callback URL, Simple Log Service | Automated 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:
An ApsaraDB for MongoDB instance (standalone, replica set, or sharded cluster)
An alert contact and alert contact group configured in CloudMonitor. See Create an alert contact or an alert contact group
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.
Log on to the CloudMonitor console.
In the left navigation pane, choose Event Center > Event Subscription.
On the Subscription Policies tab, click Create Subscription Policy.
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).
Click Create Notification Configuration.
Enter a name for the configuration.
Set Notification Settings to Directly Set Notification Group.
Select an alert Contact Group.
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.Parameter Example value Description Product ApsaraDB for MongoDB The cloud service to monitor. Event Type Abnormal The category of event. Event Name Instance Failure Start The specific event to subscribe to. Event Level Critical The 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 contentsection 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}).Click Submit.
Test the subscription
Before a real incident occurs, verify that your notification chain is working correctly:
On the Subscription Policies tab, click Debug Event Subscription.
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.
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.
Log on to the MongoDB console.
In the left navigation pane, click Replica Set Instances or Sharded Cluster Instances based on your instance type.
In the upper-left corner, select the resource group and region of the instance.
Click the ID of the instance, or click Manage in the Actions column.
In the left navigation pane, click Alert Rules.
In the upper-left corner, click Set Alert Rule. You are redirected to the CloudMonitor console.
On the Alert Rules page, click Create Alert Rule.
In the Create Alert Rule panel, configure the following parameters:
Parameter Description Product The 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 Range The 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 Description The 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 Period How 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 Period The time window during which the alert rule is active. CloudMonitor only evaluates metrics and sends alerts within this period. Alert Contact Group The contact group to receive alert notifications. A group can contain one or more contacts. Tag A 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. 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
| Operation | Description |
|---|---|
| PutEventRule | Creates or modifies an event alert rule in CloudMonitor. |
What's next
CloudMonitor event list for ApsaraDB for MongoDB — Browse all system events you can subscribe to.
Manage notification configurations — Update contacts, escalation policies, and delivery methods.
Manage push channels — Route alerts to external systems.