Subscribe to event notifications
ApsaraDB for MongoDB integrates with CloudMonitor. You can subscribe to system events and set alert rules to track events and instance health in real time.
Background
CloudMonitor provides two ways to deliver alert notifications when a system exception occurs, such as a cloud service failure.
Subscribe to events: Receive event notifications through text messages, email, or DingTalk chatbots for a fast response.
Set alerts: Route alerts to Simple Message Queue, Function Compute, a callback URL, or Simple Log Service to automate exception handling.
Procedure
Subscribe to an event
The following example uses the Instance Failure Start system event to show how to subscribe to an event.
Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
On the Subscription Policy tab, click Create a subscription policy.
On the Create a subscription policy page, configure the 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. Do not configure the Application Group, Event Content, or Event Resources parameters. This subscribes your account to the Instance Failure Start system event for all ApsaraDB for MongoDB instances across all application groups.
NoteFor more information about the system events supported by ApsaraDB for MongoDB, see System events.
Combined Noise Reduction: Use the default settings.
Notification: Create a notification configuration. Use the default setting for Custom Notification Method.
When you create a notification configuration, enter a name, set Notification Settings to Set Notification Group Directly, select an alert Contact Group, and then click OK.
NoteFor more information about how to create a notification configuration, see Manage notification configurations.
The system sends alert notifications based on the contact methods configured for the alert contacts in the group. For example, if an alert contact has both a phone number and an email address, and Custom Notification Method uses the default method, the contact will receive only alert calls, text messages, and emails.
Push and Integration: No configuration is required.
NoteFor more information about how to create a push channel, see Manage push channels.
Table 1. Subscription policy parameters
Section
Parameter
Description
Basic Infomation
Name
The subscription policy name.
Description
The subscription policy description.
Alert Subscription
Subscription Type
The alert subscription type. 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 an event occurs. You must configure the subscription scope for system events, including Product, Event Type, Event Name, Event Level, Application Group, Event Content, and Event Resources.
Event Content: This field performs a containment match for keywords. To specify multiple keywords, separate them with commas (,). In whitelist mode, an event matches if its content includes any of the specified keywords. In blacklist mode, an event matches only if its content includes all of the specified keywords. For example, if you are in whitelist mode and enter
re,1754xxxxx651403, all events that contain eitherreor1754xxxxx651403are returned."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 corresponding cloud product, such as
acs:ecs:cn-shanghai:{uid}:instance/{instanceId}. The input box matches resources that contain the keywords you enter. To specify multiple keywords, separate them with a comma (,). In whitelist mode, a resource is matched if it contains any of the specified keywords. In blacklist mode, a resource is matched only if it contains all of the specified keywords. For example, in whitelist mode, if you enterinstanceId_1,instanceId_2, events from instances with the IDinstanceId_1orinstanceId_2are matched.
Threshold Events: When a threshold-based alert rule is triggered, CloudMonitor also generates a threshold event. Subscribing to threshold events lets you control and customize alert notifications at a finer granularity, such as combined noise reduction and custom notification methods. You must set the subscription scope for threshold events, including Product Category, Metric, Severity Level, and Application Group.
Combined Noise Reduction
NoteIf you do not configure a merge rule, all alerts accepted by the subscription policy are merged by default.
Merge Content
Select a merge dimension from the Subscription Type section of the Subscription Scope.
Noise Reduction
Reduces the frequency of alert notifications. Options:
Conditional trigger, suppress after trigger: A mute period (default: 5 minutes) begins if an alert is triggered a specified number of consecutive times (default: 5) within a specified period (default: 5 minutes). During the mute period, no duplicate notifications are sent. This process repeats after the mute period ends.
Direct trigger, suppress after trigger: A notification is sent immediately after an alert is triggered. Then, a mute period (default: 5 minutes) begins, during which no duplicate notifications are sent. This process repeats after the mute period ends.
Direct trigger, no suppression (uses system default anti-storm settings): A notification is sent immediately after an alert is triggered.
NoteThe default anti-storm rules are as follows:
Text messages: 5 per 2 minutes.
Phone calls: 3 per 2 minutes.
Emails: Up to 50 per 5 minutes.
Notification
Notification Configurations
When system event or threshold event conditions are met, notifications are sent 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 more information about how to configure a notification policy, see Manage notification configurations.
Custom Notification Method
Customizes alert notification methods.
Click Edit next to a notification method to change the Notification Templates and Alert Level.
Push and Integration
Push Channel
The channel for pushing alert notifications. To create one:
Click Create New Push.
Select an existing push channel or click Add Channel to create a new one.
For more information about how to configure parameters for a push channel, see Manage push channels.
Click Submit.
Debug the event subscription.
On the Subscription Policy tab, click Debug Event Subscription.
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.
Click OK.
The system displays an Operation Successful message. CloudMonitor then automatically sends a test alert notification to the alert contacts based on the notification methods in the subscription policy.
Set an alert rule
Create an alert contact or an alert contact group. For more information, see Create an alert contact or an alert contact group.
Log on to the ApsaraDB for MongoDB console.
In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances depending on your instance type.
In the upper-left corner of the page, select the resource group and region for your instance.
Click the ID of the target instance, or click Actions in the Manage column.
Configure event alerts.
In the left-side navigation pane of the instance details page, click Alert Rules.
Click Set Alert Rule to go to the CloudMonitor console.
Click Create Alert Rule.
In the Create Alert Rule panel, configure the following parameters.
Parameter
Description
Product
No modification required. The default value is the type of the current instance.
Resource Scope
The cloud product resources to which the alert rule applies. Default value: Instances.
Related Resource
No modification required. The default value is the ID of the current instance.
Rule Description
The core of the alert rule. An alert is triggered when monitoring data meets the specified conditions. To configure:
Click Add Rule.
In the Set 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 for it.
Multiple Metrics: Select an alert level and then set alert conditions for two or more metrics.
Dynamic Threshold: For more information about intelligent thresholds, see Overview and Create an alert rule for an intelligent threshold.
Click OK.
NoteFor more information about how to set complex alert conditions, see Expressions for alert rules.
Mute Period
The interval between alert notifications for an unresolved issue. Valid values: 5 Minutes, 15 Minutes, 30 Minutes, 60 Minutes, 3 Hours, 6 Hours, 12 Hours, and 24 Hours.
When a metric exceeds its threshold, CloudMonitor triggers an alert and begins a mute period. During this period, no further notifications are sent. If the issue persists after the mute period ends, another notification is sent.
For example, if you set the Mute Period to 12 Hours, CloudMonitor sends another alert notification after 12 hours if the alert is not resolved.
Effective Period
The period during which the alert rule is active. Notifications are sent only during this period.
NoteWhen an alert rule is outside its effective period, no alert notifications are sent. However, alert history records are still displayed in the Alert History list.
Alert Contact Group
The contact group that receives alert notifications.
An alert contact group can contain one or more alert contacts. Notifications for an application group are sent to the contacts in this group.
For more information about how to create alert contacts and alert contact groups, see Create an alert contact or an alert contact group.
Tags
The alert rule tag, consisting of a tag key and a tag value.
NoteYou can add up to six tags.
Alert Callback
A publicly accessible URL that receives alert information from CloudMonitor via POST requests. Only HTTP is supported. For more information, see Use a threshold-triggered alert callback.
To test the connectivity of the callback URL, perform the following steps:
Click Test to the right of the callback URL.
In the Webhook Test panel, you can check the connectivity of the callback URL based on the status code and test results returned by the webhook.
NoteYou can also set the Callback Template Type and Language re for the webhook, and then click Test again to get the corresponding test results.
Click Close.
NoteTo configure this parameter, click Advanced Settings.
Auto Scaling
If you enable the Auto Scaling switch, the corresponding scaling rule is triggered when an alert occurs. You must specify the Region, ESS Group, and ESS Rule for Auto Scaling.
For more information about how to create a scaling group, see Configure scaling groups.
For more information about how to create a scaling rule, see Configure scaling rules.
NoteTo configure this parameter, click Advanced Settings.
Simple Log Service
If you enable the Simple Log Service switch, alert information is sent to a Logstore in Simple Log Service when an alert occurs. You must specify the Region, ProjectName, and Logstore for Simple Log Service.
For more information about how to create a project and a Logstore, see Use Logtail to collect and analyze text logs on ECS instances.
NoteTo configure this parameter, click Advanced Settings.
Simple Message Queue (formerly MNS) - Topic
If you enable the Simple Message Queue (formerly MNS) - Topic switch, alert information is sent to a topic in Simple Message Queue when an alert occurs. You must specify the region and topic for Simple Message Queue.
For more information about how to create a topic, see Create a topic.
NoteTo configure this parameter, click Advanced Settings.
Function Compute
If you enable the Function Compute switch, alert notifications are sent to Function Compute for processing when an alert occurs. You must specify the region, service, and function for Function Compute.
For more information about how to create a service and a function, see Create a function.
NoteTo configure this parameter, click Advanced Settings.
No-Data Handling
How to handle alerts when no monitoring data is available. Valid values:
Do not do anything (default)
Send alert notifications
NoteTo configure this parameter, click Advanced Settings.
Click OK.
Related APIs
CloudMonitor API | Description |
Creates or modifies an alert rule for an event. |