Manage event-triggered tasks
If your business may encounter traffic surges or has no specific business patterns, you can create event-triggered tasks and associate CloudMonitor metrics with the tasks to manage your business with ease. Auto Scaling collects metric statistics in real time. During the statistical period, if the alert conditions are met, Auto Scaling triggers alerts and executes scaling rules within the effective periods of the event-triggered tasks to dynamically adjust the number of Elastic Compute Service (ECS) instances or elastic container instances in scaling groups. This topic describes how to create, view, disable, enable, modify, or delete event-triggered tasks.
Create event-triggered tasks
-
Log on to the Auto Scaling console.
-
In the left-side navigation pane, click .
-
In the top navigation bar, select a region.
-
Specify the monitoring type of the event-triggered task that you want to create and create the task.
-
To access 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 click OK.
Parameter
Description
Name
Enter a name for the event-triggered task. The name must be 2 to 64 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). It must start with a letter or digit.
Description
Enter a description for the event-triggered task. The description must be 2 to 255 characters in length, and can reflect the purpose of the task.
Resource Monitored
Select a scaling group that you want to monitor. You can search for a scaling group by name. You can specify scaling groups of the ECS type or scaling groups of the Elastic Container Instance type.
Monitoring Type
The default value is System Monitoring. You do not need to configure this parameter.
Alert Condition
Specify one or more alert conditions that must be met before an alert is triggered. You must specify at least one metric. If you want to specify multiple metrics, click Add Metric. An alert condition consists of the following parts:
-
Metrics: Specify system metrics, such as (Agent) CPU Utilization and (Agent) Memory. For more information, see Event-triggered tasks of the system monitoring type.
NoteThe supported system metrics vary based on the scaling group type. The metrics displayed in the console prevail.
-
Statistical methods: Specify rules based on the average, minimum, or maximum value of metric data to check whether the metric data is within the allowed range. For example, you use CPU Utilization as the metric and 80% as the threshold. The following rules apply:
-
Average: If the average CPU utilization of the ECS instances or elastic container instances that are monitored is greater than 80%, Auto Scaling triggers an alert.
-
Maximum: If the maximum CPU utilization of the ECS instances or elastic container instances that are monitored is greater than 80%, Auto Scaling triggers an alert.
-
Minimum: If the minimum CPU utilization of the ECS instances or elastic container instances that are monitored is greater than 80%, Auto Scaling triggers an alert.
-
Report Alerts When
You can set this parameter to All metrics meet the condition or One of the metrics meets the condition.
Reference Period
Select a statistical period for the metric data. Valid values: 15 Seconds, 1 Minute, 2 Minutes, 5 Minutes, and 15 Minutes. Auto Scaling collects, summarizes, and compares metric data based on the specified statistical period. The shorter the period, the more frequently alerts are triggered. Configure the statistical period as needed.
NoteYou can set the value of this parameter to 15 Seconds for only scaling groups of the ECS type.
Triggered After
Specify the number of times that the alert condition must be met before an alert is triggered. Auto Scaling counts the number of times that the condition is met. When the number reaches the value of the Triggered After parameter, Auto Scaling triggers an alert and executes the scaling rule that is specified in the event-triggered task.
Effective Period
Specify an effective period for the event-triggered task. During the effective period, Auto Scaling executes the scaling rule that is specified in the event-triggered task after alerts are triggered. If alerts are triggered beyond the effective period, Auto Scaling does not execute the scaling rule.
-
Not set: The default is to be always effective.
-
Cron Expression: The event-triggered task is effective only within the time range that is specified by the cron expression. For more information about cron expressions, see Cron expression.
Triggered Rule
The scaling rule that is executed when the conditions are met. You must specify one and only one trigger rule for the event-triggered task. The trigger 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 click OK.
Parameter
Description
Name
Enter a name for the event-triggered task. The name must be 2 to 64 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). It must start with a letter or digit.
Description
Enter a description for the event-triggered task. The description must be 2 to 255 characters in length, and can reflect the purpose of the task.
Resource Monitored
Select a scaling group that you want to monitor. You can search for a scaling group by name. You can specify scaling groups of the ECS type or scaling groups of the Elastic Container Instance type.
Monitoring Type
Custom metrics that you report to CloudMonitor. The default value is Custom Monitoring. You do not need to configure this parameter.
Application Group
Before you create an event-triggered task of this type, you must report your custom metrics to CloudMonitor. You must specify the ID of the CloudMonitor application group when you report custom metrics. If no application group is available, you must create an application group in the CloudMonitor console. For more information, see Create an application group.
Monitoring Metrics
Select a custom metric that you want to use. For more information about how to view custom metrics, see Event-triggered tasks of the custom monitoring type.
Dimension
Select a dimension of the custom metric that you want to use. In most cases, the dimension determines the monitoring scope.
For example, a metric with the
ecs_iddimension monitors the CPU data of a specific ECS server.Reference Period
Select a statistical period for the metric data. Valid values: 1 Minute, 2 Minutes, 5 Minutes, and 15 Minutes. Auto Scaling collects, summarizes, and compares metric data based on the specified statistical period. The shorter the period, the more frequently alerts are triggered. Configure the statistical period as needed.
Statistical Method
Specify rules based on the average, minimum, or maximum value of metric data to check whether the metric data is within the allowed range. For more information, see Statistical methods.
Triggered After
Specify the number of times that the alert condition must be met before an alert is triggered. Auto Scaling counts the number of times that the condition is met. When the number reaches the value of the Triggered After parameter, Auto Scaling triggers an alert and executes the scaling rule that is specified in the event-triggered task.
Effective Period
Specify an effective period for the event-triggered task. During the effective period, Auto Scaling executes the scaling rule that is specified in the event-triggered task after alerts are triggered. If alerts are triggered beyond the effective period, Auto Scaling does not execute the scaling rule.
-
If not set, it is always in effect.
-
Cron Expression: The event-triggered task is effective only within the time range that is specified by the cron expression. For more information about cron expressions, see Cron expression.
Triggered Rule
The scaling rule that is executed when the conditions are met. You must specify one and only one trigger rule for the event-triggered task. The trigger rule must belong to the monitored scaling group.
-
View event-triggered tasks
You can view the basic information, trigger rules, and monitoring details of event-triggered tasks. This way, you can understand the configurations of the event-triggered tasks and the data trend of metrics.
-
Log on to the Auto Scaling console.
-
In the left-side navigation pane, click .
-
In the top navigation bar, select a region.
-
Select the monitoring type.
-
To select an event-triggered task for system monitoring, click the System Monitoring tab.
-
Click the Custom Monitoring tab to select a custom monitoring event-triggered task.
-
-
Find the desired event-triggered task and click the task ID in the Task Name/ID column.
-
You can view the details of the event-triggered task.
You can view the basic information, trigger rules, and monitoring details of an event-triggered task. The following table describes the sections that you can view.
Section
Description
Basic Information
This section displays information such as the task name, task ID, status, statistical period, monitored resource, monitoring type, trigger condition, and description of the event-triggered task. This section also displays the option of whether to trigger scaling rules.
If the Alert Status of the task is Insufficient Data, it may be because the source data for the Auto Scaling event-triggered task is from Cloud Monitor, but Cloud Monitor failed to collect data from the corresponding ECS server. For information about how to resolve this issue, see What to do if an event-triggered task in Auto Scaling reports insufficient data?.
Triggered Rule
This section displays the scaling rule that is executed after an alert is triggered. You can view the scaling group to which the scaling rule belongs and the details of the scaling rule.
Monitoring Details
This section displays the data trend of the metric that you specified. You can enable Auto Refresh to refresh the metric data in real time. You can also manually refresh the metric data.
Disable or enable an event-triggered task
-
You can disable event-triggered tasks that are no longer required. Before you disable an event-triggered task, make sure that the task is in the Normal, Alarm, or Insufficient Data state.
-
You can enable event-triggered tasks that are in the Disabled state. Before you enable an event-triggered task, make sure that the event-triggered task is in the Disabled state.
-
Log on to the Auto Scaling console.
-
In the left-side navigation pane, click .
-
In the top navigation bar, select a region.
-
Select the monitoring type.
-
To select an event-triggered task for system monitoring, click the System Monitoring tab.
-
Click the Custom Monitoring tab to select a custom monitoring event-triggered task.
-
-
Disable or enable an event-triggered task.
-
Disable an event-triggered task: Find the event-triggered task that you want to disable and click Disabled in the Actions column.
-
Enable an event-triggered task: Find the event-triggered task that you want to enable and click Enable in the Actions column.
-
-
Click OK.
Modify or delete event-triggered tasks
If an event-triggered task in a scaling group no longer meets your needs, you can modify its properties without recreating it. You can also delete a task that is no longer required.
-
Log on to the Auto Scaling console.
-
In the left-side navigation pane, click .
-
In the top navigation bar, select a region.
-
Select the monitoring type.
-
Click the System Monitoring tab to select a system monitoring event-triggered task.
-
To select a custom monitoring event-triggered task, click the Custom Monitoring tab.
-
-
Modify or delete an event-triggered task.
-
Modify an event-triggered task: Find the event-triggered task that you want to modify and click Edit in the Actions column.
When you modify an event-triggered task, you cannot modify the settings of the Resource Monitored and Monitoring Type parameters. For more information, see Create event-triggered tasks.
ImportantIf you specify a target tracking scaling rule in an event-triggered task, you cannot modify the basic information of the task.
To modify the trigger rule for a task, find the task and click Edit Trigger Rule in the Actions column to add or delete trigger rules.
NoteIn the Edit Trigger Rule dialog box, you can add more than one trigger rule. The trigger rules that you add can belong to different scaling groups in the same region. This way, you can adjust the number of instances in the scaling groups that share the same trigger rule at the same time. You can also delete all trigger rules to ensure that only the monitoring feature of event-triggered tasks is used, and no scaling activities are triggered.
-
Delete an event-triggered task: Find the event-triggered task that you want to delete and click Delete in the Actions column.
ImportantIf you specified a step scaling rule in an event-triggered task, you cannot delete the event-triggered task. If you want to delete the event-triggered task, you must delete the step scaling rule first.
-
-
Click OK.