Create an alert rule
Alert rules monitor resource usage across Alibaba Cloud services. When a metric meets an alert condition, Cloud Monitor automatically sends a notification to help you detect anomalies and respond quickly.
Procedure
-
Log on to the Cloud Monitor console.
-
In the left-side navigation pane, choose .
-
On the Alert Rules page, click Create Alert Rule.
-
In the Create Alert Rule panel, configure the alert rule parameters.
Example: Create an alert rule that notifies all contacts in the Alert Contact Group when the maximum CPU utilization of any Elastic Compute Service (ECS) instance is 85% or higher for three consecutive periods(Notification methods: Phone Call + Text Message + Email + WebHook).
-
Select Product as Elastic Compute Service (ECS). Select Resource Range as All Resources.
-
Configure the rule conditions.
-
Click Add Rule and select a metric type.
-
In the Configure Rule Description panel, enter a Alert Rule. For Metric Type, select Simple Metric. For Metric, select . In the Critical section, set the trigger condition to three consecutive periods (one period equals one minute) and set the maximum value to be greater than or equal to 85%.
-
Click OK.
-
ECS CPU monitoring metrics
When you configure the monitoring metric, the Metric drop-down list contains two CPU-related metrics: (ECS) CPU Utilization and (Agent) cpu.total. They differ in data source and use case. Select the metric based on your requirements:
Attribute
(ECS) CPU Utilization
(Agent) cpu.total
Metric name
CPUUtilizationcpu_totalMonitoring type
Basic Monitoring
OS Monitoring (Agent)
Data source
Collected directly from the host
Collected by the Cloud Monitor agent
Plug-in required
No
Yes
Collection interval
60/300/3600 seconds
15/60/900 seconds
Scenario
Quick setup of general CPU alerts
Precise CPU monitoring and troubleshooting
(ECS) CPU Utilization is collected directly from the host and requires no plug-in, making it suitable for quickly setting up general CPU alerts. (Agent) cpu.total is collected by the Cloud Monitor agent, which must be installed on the ECS instance, making it suitable for scenarios that require precise CPU usage data or CPU anomaly troubleshooting.
Table 1. Parameter descriptions for alert rules
Parameter
Description
Product
An Alibaba Cloud service monitored by Cloud Monitor. Example: ApsaraDB RDS.
Resource Range
Scope of resources for this alert rule. Valid values:
-
All Resources: Applies to all resources of the specified product, including resources added later.
-
Application Groups: Applies to all resources in the specified application group of the selected product, including resources added later.
-
Instances: Applies to the specified resource of the selected product only.
Multiple alert rules with different resource scopes can cover the same instance at the same time. For example, an instance can fall within both the All Resources scope and an application group. Each alert rule is evaluated and triggered independently. Alert rules do not affect each other, and overlapping resource scopes do not cause priority overrides or conflicts.
Rule Description
Defines when Cloud Monitor triggers an alert. To configure:
-
Click Add Rule and select a metric type.
-
In the Configure Rule Description panel, enter a Alert Rule, then define the rule conditions.
-
Simple Metric: Select a metric, then set its threshold and alert level.
Alert levels use an escalations model. When the threshold reaches a specific level, only that level is triggered; other levels are not triggered simultaneously. For example, if the threshold directly reaches Critical, only the Critical alert is triggered, and the Info and Warning alerts are not triggered at the same time.
-
Combined Metrics: Select an alert level, then define an alert condition using two or more metrics.
NoteMulti-metric alert rules require the target resource to report data for every included metric. For example, if the rule includes a public network metric but the ECS instance has no public IP address, the alert does not trigger.
-
Expression: Select an alert level, then define an alert expression.
-
Dynamic Threshold: Smart threshold details: Overview | Create a smart threshold alert rule.
-
NoteComplex alert expressions: Alert rule expression reference.
Mute Period
Interval between repeated alert notifications when an alert remains active and unacknowledged. Valid values: 5 minutes, 15 minutes, 30 minutes, 60 minutes, 3 hours, 6 hours, 12 hours, and 24 hours.
When a metric crosses its alert threshold, Cloud Monitor sends an alert. No additional alerts are sent during the mute period. After the mute period ends, if the metric still exceeds the threshold, Cloud Monitor sends another alert.
For example, if you set the Mute Period to 12 hours and the alert remains active, Cloud Monitor sends another alert 12 hours later.
Effective Period
The time range during which the alert rule is active. Alerts are sent only during this period.
NoteOutside the effective period, alerts are not sent, but alert history records still appear in the alert history list.
Alert Contact Group
The group of contacts who receive alert notifications.
An alert contact group contains one or more alert contacts. Notifications for an application group are sent to all contacts in this group.
To create contacts or groups, see Create an alert contact or alert contact group.
Tag
A tag for the alert rule. Each tag has a name and a value.
NoteYou can add up to six tags.
Alert Callback
A publicly accessible URL that receives alert data from Cloud Monitor via HTTP POST requests. Only HTTP is supported. Use threshold-based alert callbacks.
To test connectivity to the callback URL:
-
Click Test, located directly to the right of the callback URL.
In the WebHook Test panel, check the HTTP status code and test result details to verify connectivity.
NoteYou can also set the Test Template Type: and Language:. Then click Test again to view updated test results.
-
Click Close.
NoteClick Advanced Settings to configure this parameter.
When an alert is triggered, the alert rule can only send notifications through channels such as text messages, emails, WebHook, and DingTalk chatbot, or integrate with other Alibaba Cloud services, such as Auto Scaling, Function Compute, and Simple Log Service. The alert rule cannot automatically perform isolation or blocking actions, such as modifying Object Storage Service (OSS) permissions or taking an ECS instance offline. To implement automated blocking, you can use a WebHook callback together with CloudOps Orchestration Service (OOS) or a custom Function Compute function.
Auto Scaling
If you enable Auto Scaling, Cloud Monitor triggers the associated scaling rule when an alert occurs. You must specify the Region, ESS Group, and ESS Rule.
NoteClick Advanced Settings to configure this parameter.
Simple Log Service
If you enable Simple Log Service, Cloud Monitor sends alert data to a Logstore in Simple Log Service (SLS) when an alert occurs. You must specify the Region, ProjectName, and Logstore.
Collect and analyze ECS text logs using LoongCollector.
NoteClick Advanced Settings to configure this parameter.
Simple Message Queue (formerly MNS) - Topic
If you enable Simple Message Queue (formerly MNS) - Topic, Cloud Monitor sends alert data to a Message Service (MNS) topic when an alert occurs. You must specify the region and topic.
NoteClick Advanced Settings to configure this parameter.
Function Compute
If you enable Function Compute, Cloud Monitor sends alert notifications to Function Compute (FC) for custom formatting when an alert occurs. You must specify the region, service, and function.
NoteClick Advanced Settings to configure this parameter.
Method to handle alerts when no monitoring data is found
How Cloud Monitor handles alerts when no monitoring data is available. Valid values:
-
Do not do anything (default)
-
Send alert notifications
-
Treated as normal
For some Alibaba Cloud service metrics, such as ApsaraMQ for RocketMQ throttling metrics, Cloud Monitor does not report monitoring data when the metric value is 0. If a metric has data but does not reach the alert threshold, the alert rule status is Normal. If the metric value is 0 and Cloud Monitor does not report monitoring data, the alert rule status is No data instead of Normal. To confirm whether data is reported for a metric, view the actual data of the instance dimension on the instance monitoring and alerting page.
When an alert rule triggers a no-data alert, Cloud Monitor sends the notification at the highest alert level configured in the rule. For example, if a rule is configured with the Critical, Warn, and Info levels, a no-data alert is sent at the Critical level. If a rule is configured only with the Info level, the no-data alert is sent at the Info level.
NoteClick Advanced Settings to configure this parameter.
After you delete a monitored resource, the alert rules that are associated with that resource are automatically removed. For example, if the Resource Range of an alert rule is a specific ECS instance, the alert rules associated with that instance are removed immediately after the instance is deleted, and no new alert history records are generated.
To manage alert rules that are associated with expired resources, see Alert rules associated with expired resources.
-
-
Click Confirm.