If your business load experiences an unexpected surge or is unpredictable, you can create event-triggered tasks in Auto Scaling and associate the event-triggered tasks with CloudMonitor metrics. Auto Scaling dynamically collects real-time metric data. If the metric data meets the alert conditions that you specify in event-triggered tasks, the event-triggered tasks enter the Alert state and execute the specified scaling rules within the effective period of the tasks. This way, Elastic Compute Service (ECS) instances or elastic container instances in scaling groups can be automatically scaled. This topic describes how to manage event-triggered tasks.
Create event-triggered tasks
- Log on to the Auto Scaling console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select the region where Auto Scaling is activated.
- Select a type for the event-triggered task that you want to create.
- If you want to use system metrics, click the System Monitoring tab.
- If you want to use custom metrics, click the Custom Monitoring tab.
- Click Create Event-triggered Task.
- Configure the parameters of the event-triggered task.
- The following table describes the parameters of an event-triggered task if you click the System Monitoring tab.
Parameter Description Name Specify 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 (-). The name must start with a letter or a digit. Description Specify a description for the event-triggered task. The description must be 2 to 255 characters in length, and can contain information such as the purpose of the event-triggered task. Resource Monitored Specify 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. Monitor Type The default value is System Monitoring. You do not need to specify 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 task for system monitoring. Note The system metrics vary based on the type of the scaling group. The system metrics that are displayed in the Auto Scaling 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. Statistical Period Specify 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 data based on the specified statistical period. The shorter the statistical period, the more frequently alerts are triggered. Configure this parameter based on your business requirements. Note You can set the value of this parameter to 15 Seconds only for 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. Valid values: - Not Set: The event-triggered task is effective all the time.
- Cron Expression: The event-triggered task is effective only within the time range that is specified by the cron expression. For information about cron expressions, see Cron expression.
Trigger Rule Specify a scaling rule for Auto Scaling to execute after an alert is triggered. You must specify this parameter. You can specify only one scaling rule as the trigger rule for an event-triggered task. The scaling rule must belong to the scaling group for which you create the event-triggered task. - Metrics: Specify system metrics, such as (Agent) CPU Utilization and (Agent) Memory. For more information, see Event-triggered task for system monitoring.
- The following table describes the parameters of the event-triggered task if you click the Custom Monitoring tab.
Parameter Description Name Specify 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 (-). The name must start with a letter or a digit. Description Specify a description for the event-triggered task. The description must be 2 to 255 characters in length, and can contain information such as the purpose of the event-triggered task. Resource Monitored Specify 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. Monitor Type The default value is Custom Monitoring. You do not need to specify 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 Metric Specify a custom metric that you want to use. For information about how to view custom metrics, see Custom monitoring event-triggered tasks. Dimension Specify a dimension of the custom metric that you want to use. In most cases, the dimension determines the monitoring scope. For example, if you use CPU Utilization as the metric and ecs_id as the dimension, the CPU utilization of the ECS instance that is specified by ecs_id is monitored. Statistical Period Specify a statistical period for the metric data. Valid values: 1 Minute, 2 Minutes, 5 Minutes, and 15 Minutes. Auto Scaling collects, summarizes, and compares data based on the specified statistical period. The shorter the period, the more frequently alerts are triggered. Configure the statistical period based on your business requirements. 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 Aggregation 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. - Not Set: The event-triggered task is effective all the time.
- Cron Expression: The event-triggered task is effective only within the time range that is specified by the cron expression. For information about cron expressions, see Cron expression.
Trigger Rule Specify a scaling rule for Auto Scaling to execute after an alert is triggered. You must specify this parameter. You can specify only one scaling rule as the trigger rule in an event-triggered task. The scaling rule must belong to the scaling group for which you create the event-triggered task.
- The following table describes the parameters of an event-triggered task if you click the System Monitoring tab.
- Click OK.
View event-triggered tasks
You can view the basic information, trigger rules, and monitoring information of event-triggered tasks. This way, you can understand the configurations of the event-triggered tasks and the data trends of metrics.
- Log on to the Auto Scaling console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select the region where Auto Scaling is activated.
- Click the Event-triggered Tasks (System) or Event-triggered Tasks (Custom) tab.
- To select a system monitoring task, click the Event-triggered Tasks (System) tab.
- To select a custom monitoring task, click the Event-triggered Tasks (Custom) tab.
- Find the event-triggered task and click the task ID in the Task Name/ID column.
- View the details of an 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 Overview This section displays information such as the task name, task ID, status, statistical period, monitored resource, monitoring type, trigger condition, and description of event-triggered tasks. This section also displays the option of whether to trigger scaling rules. If Insufficient Data is displayed in the Status field, the metric that you specified in the event-triggered task may be a CloudMonitor metric and CloudMonitor fails to collect the metric data of the monitored ECS instance. For information about how to resolve this issue, see The insufficient data prompt appears when I create an event-triggered task in Auto Scaling.
Trigger 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 event-triggered tasks
- You can disable event-triggered tasks that you do not require. Before you disable an event-triggered task, make sure that the task is in the Normal, Alert, 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, choose .
- In the top navigation bar, select the region where Auto Scaling is activated.
- Click the Event-triggered Tasks (System) or Event-triggered Tasks (Custom) tab.
- To select a system monitoring task, click the Event-triggered Tasks (System) tab.
- To select a custom monitoring task, click the Event-triggered Tasks (Custom) tab.
- Disable or enable an event-triggered task.
- Disable an event-triggered task: Find the event-triggered task that you want to disable and click Disable 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 your event-triggered task no longer meets your business requirements, you can modify the parameter settings of the event-triggered task. You do not need to create a new event-triggered task. If you no longer require your event-triggered task, you can delete the event-triggered task.
- Log on to the Auto Scaling console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select the region where Auto Scaling is activated.
- Click the Event-triggered Tasks (System) or Event-triggered Tasks (Custom) tab.
- To select a system monitoring task, click the Event-triggered Tasks (System) tab.
- To select a custom monitoring task, click the Event-triggered Tasks (Custom) 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 Event-triggered Task in the Actions column.
You cannot modify the settings of the Resource Monitored and Monitoring Type parameters. For information about other parameters, see Create event-triggered tasks.
Note If you specify a target tracking scaling rule in an event-triggered task, you cannot modify the basic information of the task.To change the trigger rule of an event-triggered task, find the event-triggered task whose trigger rule you want to change and click Edit Trigger Rule in the Actions column.Note In 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. 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. Note You cannot delete an event-triggered task in which you specify a step scaling rule. If you want to delete the event-triggered task, you must first delete the step scaling rule.
- Modify an event-triggered task: Find the event-triggered task that you want to modify and click Edit Event-triggered Task in the Actions column.
- Click OK.