All Products
Search
Document Center

Auto Scaling:Manage event-triggered tasks

Last Updated:Jun 04, 2024

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

  1. Log on to the Auto Scaling console.

  2. In the left-side navigation pane, choose Scaling Tasks > Event-Triggered Tasks.

  3. In the top navigation bar, select the region where Auto Scaling is activated.

  4. Specify the monitoring type of the event-triggered task that you want to create and create the task.

    • If you want to create a task of the system monitoring type, click the Event-triggered Tasks (System) tab.

    • If you want to create a task of the custom monitoring type, click the Event-triggered Tasks (Custom) tab

    System monitoring

    On the Event-triggered Tasks (System) tab, click Create Event-triggered Task. In the Create Event-triggered Task dialog box, configure parameters based on your business requirements. Then, 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.

      Note

      The system metrics vary based on the type of the scaling group. The system metrics that are displayed in the Auto Scaling console shall 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

    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 based on your business requirements.

    Note

    You 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 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 more 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 configure 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 created the event-triggered task.

    Custom monitoring

    On the Event-triggered Tasks (Custom) tab, click Create Event-triggered Task. In the Create Event-triggered Task dialog box, configure parameters based on your business requirements. Then, 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 Metric

    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, 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

    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 based on your business requirements.

    Condition

    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 more 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 configure 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.

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.

  1. Log on to the Auto Scaling console.

  2. In the left-side navigation pane, choose Scaling Tasks > Event-Triggered Tasks.

  3. In the top navigation bar, select the region where Auto Scaling is activated.

  4. Select the monitoring type.

    • 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.

  5. Find the event-triggered task and click the task ID in the Task Name/ID column.

  6. 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

    Basic Info

    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 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 may fail to collect the metric data of the monitored ECS instance. For more information, see What do I do if an event-triggered task in Auto Scaling indicates insufficient data?

    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 are no longer required. 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.

  1. Log on to the Auto Scaling console.

  2. In the left-side navigation pane, choose Scaling Tasks > Event-Triggered Tasks.

  3. In the top navigation bar, select the region where Auto Scaling is activated.

  4. Select the monitoring type.

    • 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.

  5. 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.

  6. In the message that appears, click OK.

Modify or delete event-triggered tasks

If your event-triggered task does not meet your business requirements, you can modify the parameter settings of the event-triggered task, without the need to create a new one. If you no longer require your event-triggered task, you can delete the event-triggered task.

  1. Log on to the Auto Scaling console.

  2. In the left-side navigation pane, choose Scaling Tasks > Event-Triggered Tasks.

  3. In the top navigation bar, select the region where Auto Scaling is activated.

  4. Select the monitoring type.

    • 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.

  5. 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.

      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.

      Important

      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 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.

      Important

      If 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.

  6. Click OK.