For services that have traffic bursts or unpredictable workloads, you can use event-triggered tasks that are associated with Cloud Monitor metrics. Auto Scaling collects and analyzes metric data in real time. If the data meets the alert conditions, an alert is triggered. Auto Scaling then automatically executes the associated scaling rule within the effective period to adjust the number of ECS instances or ECI instances in the scaling group. This topic describes how to create, view, disable, enable, modify, and delete event-triggered tasks.
Create an event-triggered task
Log on to the Auto Scaling console.
In the navigation pane on the left, click .
In the top navigation bar, select a region.
-
You can select a monitoring type and create the event-triggered task.
-
To use system-defined metrics, click the System Monitoring tab.
-
To use custom metrics, click the Custom Monitoring tab.
System monitoring
On the System Monitoring tab, click Create Event-triggered Task, configure the following parameters, and then click OK.
Parameter
Description
Name
Enter a name for the event-triggered task. The name must be 2 to 64 characters in length. It must start with a letter or a digit and can contain periods (.), underscores (_), and hyphens (-).
Description
Enter a description for the event-triggered task. The description must be 2 to 255 characters in length and can explain the purpose of the task.
Resource Monitored
Select the scaling group to monitor. You can search for the scaling group by name. The scaling group can contain ECS instances or ECI instances.
Monitoring Type
The metrics that Cloud Monitor collects. The default value is System Monitoring. You do not need to set this parameter.
Alert Condition
The conditions that must be met to trigger an alert. You must select one or more system-defined metrics. To add more metrics, click Add Metric. This section includes two parts:
-
Metric: The name of a metric that system monitoring supports, such as (Agent) CPU Utilization or (Agent) Memory Utilization. For more information, see System monitoring event-triggered tasks.
NoteThe metrics that system monitoring supports vary based on the type of scaling group. The metrics displayed on the page in the console prevail.
-
Statistical Method: The rule that determines whether a metric value exceeds the threshold. You can set rules based on the average, maximum, or minimum value. For example, if the condition is that the CPU utilization is greater than 80%:
-
Average: An alert is triggered if the average CPU utilization of all ECS or ECI instances in the scaling group is greater than 80%.
-
Maximum: An alert is triggered if the CPU utilization of the ECS or ECI instance with the highest CPU utilization in the scaling group is greater than 80%.
-
Minimum: An alert is triggered if the CPU utilization of the ECS or ECI instance with the lowest CPU utilization in the scaling group is greater than 80%.
-
Report Alerts When
Specifies the relationship between multiple metrics. You can choose to trigger an alert All metrics meet the condition or One of the metrics meets the condition.
Reference Period
You can select 15 Seconds, 1 Minute, 2 Minutes, 5 Minutes, or 15 Minutes. Auto Scaling collects, aggregates, and compares data based on the statistical period. A shorter period makes it easier to trigger an alert. Select a period that suits your business needs.
NoteA statistical period of 15 seconds is supported only for scaling groups of the ECS type.
Triggered After
The number of consecutive times the metric must meet the condition before an alert is triggered. When the metric value exceeds the threshold, Auto Scaling counts the occurrences. The alert and the scaling rule are triggered only after the specified number of consecutive occurrences is reached.
Effective Period
The period during which the event-triggered task is active. Within this period, the specified scaling rule is automatically executed when an alert is triggered. Outside this period, an alert is triggered but the scaling rule is not executed.
-
Not set: The task is always active by default.
-
Set Cron Expression: The task is active only during the time range specified by the cron expression. For more information about cron expressions, see Cron expressions.
Triggered Rule
The scaling rule that is executed when the conditions are met. You must specify one and only one alert-triggered rule. The rule must belong to the monitored scaling group.
Custom monitoring
On the Custom Monitoring tab, click Create Event-triggered Task, configure the following parameters, and then click OK.
Parameter
Description
Name
Enter a name for the event-triggered task. The name must be 2 to 64 characters in length. It must start with a letter or a digit and can contain periods (.), underscores (_), and hyphens (-).
Description
Enter a description for the event-triggered task. The description must be 2 to 255 characters in length and can explain the purpose of the task.
Resource Monitored
Select the scaling group to monitor. You can search for the scaling group by name. The scaling group can contain ECS instances or ECI instances.
Monitoring Type
The custom metrics that you report to Cloud Monitor. The default value is Custom Monitoring. You do not need to set this parameter.
Application Group
Before you create an event-triggered task for custom monitoring, you must report custom metrics to Cloud Monitor. When you report the metrics, you must specify a Cloud Monitor application group ID. This can be an existing application group ID. If the application group does not exist, you must create one in the Cloud Monitor console. For more information, see Create an application group.
Monitoring Metrics
Select a custom metric. For more information about how to view custom metrics (metric time series), see Custom monitoring event-triggered tasks.
Dimension
Select a monitoring dimension. This is the dimension that you set for your custom metric. It usually specifies the scope of resources that the metric time series monitors.
For example, if you use ecs_id as the dimension, the metric monitors the CPU data of that specific ECS server.
Reference Period
You can select 1 Minute, 2 Minutes, 5 Minutes, or 15 Minutes. Auto Scaling collects, aggregates, and compares data based on the statistical period. A shorter period makes it easier to trigger an alert. Select a period that suits your business needs.
Statistical Method
The rule that determines whether a metric value exceeds the threshold. You can set rules based on the average, maximum, or minimum value. For more information, see Statistical methods.
Triggered After
The number of consecutive times the metric must meet the condition before an alert is triggered. When the metric value exceeds the threshold, Auto Scaling counts the occurrences. The alert and the scaling rule are triggered only after the specified number of consecutive occurrences is reached.
Effective Period
The period during which the event-triggered task is active. Within this period, the specified scaling rule is automatically executed when an alert is triggered. Outside this period, an alert is triggered but the scaling rule is not executed.
-
Not set: The task is always active by default.
-
Set Cron Expression: The task is active only during the time range specified by the cron expression. For more information about cron expressions, see Cron expressions.
Triggered Rule
The scaling rule that is executed when the conditions are met. You must specify one and only one alert-triggered rule. The rule must belong to the monitored scaling group.
-
View an event-triggered task
After an event-triggered task is created, you can view its basic information, alert-triggered rule, and monitoring information in the event-triggered task list. This information helps you understand the task's configuration and the change trends of its monitoring data.
Log on to the Auto Scaling console.
In the navigation pane on the left, click .
In the top navigation bar, select a region.
-
Select a monitoring type.
-
To view a system monitoring event-triggered task, click the System Monitoring tab.
-
To view a custom monitoring event-triggered task, click the Custom Monitoring tab.
-
Find the event-triggered task that you want to manage and click its ID in the Task Name/ID column.
-
View the task details.
You can view the basic information, alert-triggered rule, and monitoring information of the task. The details are described below:
Area
Description
Basic Information
Includes the task name, task ID, rule trigger status, alert status, statistical period, monitored resource, monitoring type, conditions for triggering the scaling rule, and description.
If the alert status of an event-triggered task is Insufficient Data, this may be because Cloud Monitor failed to collect the source data from the corresponding ECS server for the Auto Scaling event-triggered task. For more information, see Insufficient data is reported when you create an event-triggered task in Auto Scaling.
Triggered Rule
Lists the scaling rule that is executed when the event-triggered task is triggered. You can also view the details of the corresponding scaling group and scaling rule.
Monitoring Details
The content displayed depends on the selected metric. It shows the change trends of the metric data. You can enable auto-refresh or manually refresh the real-time monitoring data.
Disable or enable an event-triggered task
-
You can disable an event-triggered task if you want to temporarily prevent it from triggering scaling activities. Before you disable a task, its status must be Normal, Alarm, or Insufficient Data.
-
You can enable a disabled event-triggered task to resume its operation. Before you enable a task, its status must be Disabled.
Log on to the Auto Scaling console.
In the navigation pane on the left, click .
In the top navigation bar, select a region.
-
Select a monitoring type.
-
To manage a system monitoring event-triggered task, click the System Monitoring tab.
-
To manage a custom monitoring event-triggered task, click the Custom Monitoring tab.
-
-
You can disable or enable the event-triggered task.
-
Disable an event-triggered task: Find the task that you want to disable and click Disabled in the Actions column.
-
Enable an event-triggered task: Find the task that you want to enable and click Enable in the Actions column.
-
-
Click OK.
Modify or delete an event-triggered task
If an event-triggered task no longer meets your needs, you can modify one or more of its properties without having to re-create it. If you no longer use the task, you can delete it.
Log on to the Auto Scaling console.
In the navigation pane on the left, click .
In the top navigation bar, select a region.
-
Select a monitoring type.
-
To manage a system monitoring event-triggered task, click the System Monitoring tab.
-
To manage a custom monitoring event-triggered task, click the Custom Monitoring tab.
-
-
You can modify or delete the event-triggered task.
-
Modify an event-triggered task: Find the task that you want to modify and click Edit in the Actions column.
You cannot modify the Resource Monitored and Monitoring Type options. For more information about the other event-triggered task configuration items, see Create an event-triggered task.
ImportantYou cannot modify the basic information of an event-triggered task if its alert-triggered rule is a target tracking scaling rule.
To modify the alert-triggered rule for a task, find the task and click Edit Trigger Rule in the Actions column. You can then add or remove alert-triggered rules.
NoteYou can add multiple alert-triggered rules, including rules from other scaling groups in the same region. This lets you adjust associated scaling groups based on the monitoring data from a single resource. You can also remove all alert-triggered rules to use the task only for monitoring, without triggering any scaling activities.
-
Delete an event-triggered task: Find the task that you want to delete and click Delete in the Actions column.
ImportantYou cannot delete an event-triggered task that is attached to a step scaling rule. To delete the task, you must first delete the step scaling rule.
-
-
Click OK.