All Products
Search
Document Center

Auto Scaling:ModifyAlarm

Last Updated:Aug 28, 2026

Modifies the configuration of an event-triggered task.

Operation description

  • 如果您创建自定义监控类型的报警任务(MetricType=custom),您需要先将自定义监控项指标上报到云监控。具体操作,请参见自定义监控报警任务

  • 创建报警任务时,您需要指定监控项(MetricName),并配合维度信息(Dimension.N.DimensionKey 和 Dimension.N.DimensionValue),来确定伸缩组中该监控项数据的聚合范围。例如,指定 user_id 和 scaling_group 来确定聚合该用户、该伸缩组下所有 ECS 实例或 ECI 实例的监控项数据。
    • 自定义监控报警任务(MetricType=custom)的监控项取决于您自有的监控指标。

    • 系统监控报警任务(MetricType=system)支持的监控项的更多信息,请参见系统监控报警任务

Note

维度信息中,user_id 和 scaling_group 由系统自动填充,device、state 需要您手动指定。更多信息,请参见参数Dimension.N.DimensionKeyDimension.N.DimensionValue

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ess:ModifyAlarm

update

*ScalingGroup

acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the event-triggered task.

cn-qingdao

AlarmTaskId

string

Yes

The ID of the event-triggered task.

asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****

Name

string

No

The name of the event-triggered task.

alarmtask****

Description

string

No

The description of the event-triggered task.

Test alarm task.

MetricName

string

No

The name of the metric. The valid values vary based on the metric type.

  • If you set the MetricType parameter to custom, the valid values are your custom metrics.

  • If you set the MetricType parameter to system, the MetricName parameter has the following valid values:

    • CpuUtilization: the CPU utilization of an ECS instance. Unit: %.

    • IntranetTx: the outbound traffic over the internal network from an ECS instance. Unit: KB/min.

    • IntranetRx: the inbound traffic over the Internet to an ECS instance that resides in a virtual private cloud (VPC). Unit: KB/min.

    • VpcInternetTx: the outbound traffic over the Internet from an ECS instance that resides in a VPC. Unit: KB/min.

    • VpcInternetRx: the inbound traffic over the Internet to an ECS instance that resides in a VPC. Unit: KB/min.

    • SystemDiskReadBps: the number of bytes read from the system disk used by an ECS instance per second.

    • SystemDiskWriteBps: the number of bytes written to the system disk used by an ECS instance per second.

    • SystemDiskReadOps: the number of read operations on the system disk used by an ECS instance per second.

    • SystemDiskWriteOps: the number of write operations on the system disk used by an ECS instance per second.

    • CpuUtilizationAgent: the CPU utilization of an agent. Unit: %.

    • GpuMemoryFreeUtilizationAgent: the percentage of idle GPU memory of an agent.

    • GpuMemoryUtilizationAgent: the GPU memory usage of an agent. Unit: %.

    • MemoryUtilization: the memory usage of an agent. Unit: %.

    • LoadAverage: the average system load of an agent.

    • TcpConnection: the total number of TCP connections of an agent.

    • TcpConnection: the number of established TCP connections of an agent.

    • PackagesNetOut: the number of packets that are sent by the internal network interface controller (NIC) used by an agent.

    • PackagesNetIn: the number of packets that are received by the internal NIC used by an agent.

    • EciPodCpuUtilization: the CPU utilization of an elastic container instance. Unit: %.

    • EciPodMemoryUtilization: the memory usage of an elastic container instance. Unit: %.

For more information, see Event-triggered task for system monitoring.

MemoryUtilization

MetricType

string

No

The metric type. Valid values:

  • system: a system metric of CloudMonitor.

  • custom: a custom metric that is reported to CloudMonitor.

system

Period

integer

No

The statistical collection period for the metric. Unit: seconds. Valid values:

  • 15

  • 60

  • 120

  • 300

  • 900

Note

If your scaling group is of the ECS type and uses CloudMonitor metrics, you can set the Period parameter to 15. In other cases, you can set the Period parameter to 60, 120, 300, or 900. In most cases, the name of a CloudMonitor metric contains Agent.

300

Statistics

string

No

The statistical aggregation method for the metric. Valid values:

  • Average

  • Minimum

  • Maximum

Average

Threshold

number

No

The metric value thresholds in the multi-metric alert rule. When thresholds are reached the specified number of times within the specified period, a scaling rule is executed.

80

ComparisonOperator

string

No

The comparison operator for the metric value and threshold. Valid values:

  • If the metric value is greater than or equal to the threshold, set the value to >=.

  • If the metric value is less than or equal to the threshold, set the value to <=.

  • If the metric value is greater than the threshold, set the value to >.

  • If the metric value is less than the threshold, set the value to <.

>=

EvaluationCount

integer

No

The number of threshold breaches required before a scaling rule is executed. For example, if you set this parameter to 3, the average CPU utilization must reach or exceed 80% three times in a row before a scaling rule is triggered.

3

GroupId

integer

No

The application group ID of the custom metric. Required when MetricType is set to custom.

4055401

Effective

string

No

The effective period of the event-triggered task.

This parameter follows the cron expression format. The default format is X X X X X ?, in which:

  • X: a placeholder for a field, which represents seconds, minutes, hours, days, and months in sequence. X can be a definite value or a special character that has logical meaning. For information about the valid values of X, see Cron expression.

  • ?: No value is specified.

Note

By default, the value of this parameter is specified in UTC+8. You can specify the time zone in the TZ=+yy format before a cron expression. y indicates the time zone. For example, TZ=+00 * * 1-2 * * ? specifies that the event-triggered task is in effect between 01:00 and 02:59 (UTC+0) every day.

Examples:

  • * * * * * ? : The event-triggered task is in effect all the time.

  • * * 17-18 * * ? : The event-triggered task is in effect between 17:00 and 18:59 (UTC+8) every day.

  • TZ=+00 * * 1-2 * * ?: The event-triggered task is in effect between 01:00 and 02:59 (UTC+0) every day.

TZ=+00 * * 1-2 * * ?

AlarmActions

array

No

The unique identifiers of scaling rules associated with the event-triggered task.

string

No

The unique identifiers of scaling rules associated with the event-triggered task.

ari:acs:ess:cn-hangzhou:140692647****:scalingrule/asr-bp163l21e07uhn****

Dimensions

array<object>

No

The metric dimensions.

object

No

The dimension of the metric.

DimensionKey

string

No

The dimension key to associate with the metric. Valid values vary by MetricType.

  • If you set MetricType to custom, you can specify this parameter based on your business requirements.

  • If you set MetricType to system, this parameter has the following valid values:

    • user_id: the ID of your Alibaba Cloud account.

    • scaling_group: the scaling group that is monitored by the event-triggered task.

    • device: the NIC type.

    • state: the status of the TCP connection.

    • rulePool: the specified server group for the ALB qps metric.

device

DimensionValue

string

No

The dimension value of the metric. Valid values vary by Dimensions.DimensionKey.

  • If you set MetricType to custom, you can specify this parameter based on your business requirements.

  • If you set MetricType to system, Dimension.N.DimensionValue has the following valid values:

    • user_id: The system specifies the value.

    • scaling_group: The system specifies the value.

    • device:

      • eth0: For classic network instances, eth0 indicates the internal network interface controller. Only one eth0 NIC exists on each instance that resides in VPCs.

      • eth1: For classic network instances, eth1 represents the Internet network interface controller.

    • state:

      • TCP_TOTAL specifies the total number of TCP connections.

      • ESTABLISHED specifies the number of TCP connections that are established.

eth0

Expressions

array<object>

No

The expressions in the multi-metric alert rule.

object

No

The expressions in the multi-metric alert rule.

MetricName

string

No

The metric name in the multi-metric alert rule. Valid values vary by metric type.

  • If you set the MetricType parameter to custom, the valid values are your custom metrics.

  • If you set the MetricType parameter to system, the MetricName parameter has the following valid values:

    • CpuUtilization: the CPU utilization of an ECS instance. Unit: %.

    • IntranetTx: the outbound traffic over the internal network from an ECS instance. Unit: KB/min.

    • IntranetRx: the inbound traffic over the Internet to an ECS instance that resides in a VPC. Unit: KB/min.

    • VpcInternetTx: the outbound traffic over the Internet from an ECS instance that resides in a VPC. Unit: KB/min.

    • VpcInternetRx: the inbound traffic over the Internet to an ECS instance that resides in a VPC. Unit: KB/min.

    • SystemDiskReadBps: the number of bytes read from the system disk used by an ECS instance per second.

    • SystemDiskWriteBps: the number of bytes written to the system disk used by an ECS instance per second.

    • SystemDiskReadOps: the number of read operations on the system disk used by an ECS instance per second.

    • SystemDiskWriteOps: the number of write operations on the system disk used by an ECS instance per second.

    • CpuUtilizationAgent: the CPU utilization of an agent. Unit: %.

    • GpuUtilizationAgent: the GPU utilization of an agent. Unit: %.

    • GpuMemoryFreeUtilizationAgent: the percentage of idle GPU memory of an agent.

    • GpuMemoryUtilizationAgent: the GPU memory usage of an agent. Unit: %.

    • MemoryUtilization: the memory usage of an agent. Unit: %.

    • LoadAverage: the average system load of an agent.

    • TcpConnection: the total number of TCP connections of an agent.

    • TcpConnection: the number of established TCP connections of an agent.

    • PackagesNetOut: the number of packets that are sent by the internal NIC used by an agent.

    • PackagesNetIn: the number of packets that are received by the internal NIC used by an agent.

    • EciPodCpuUtilization: the CPU utilization of an elastic container instance. Unit: %.

    • EciPodMemoryUtilization: the memory usage of an elastic container instance. Unit: %.

For more information, see Event-triggered task for system monitoring.

CpuUtilization

ComparisonOperator

string

No

The comparison operator for the metric value and threshold. Valid values:

  • If the metric value is greater than or equal to the threshold, set the value to >=.

  • If the metric value is less than or equal to the threshold, set the value to <=.

  • If the metric value is greater than the threshold, set the value to >.

  • If the metric value is less than the threshold, set the value to <.

Default value: >=.

>=

Period

integer

No

The statistical collection period for metrics in the multi-metric alert rule. Unit: seconds. Valid values:

  • 15

  • 60

  • 120

  • 300

  • 900

Note

If your scaling group is of the ECS type and the event-triggered task associated with your scaling group monitors CloudMonitor metrics, you can set the Period parameter to 15. In other cases, you can set the Period parameter to 60, 120, 300, or 900. In most cases, the name of a CloudMonitor metric contains Agent.

Default value: 300.

300

Statistics

string

No

The statistical aggregation method for metrics in the multi-metric alert rule. Valid values:

  • Average

  • Minimum

  • Maximum

Average

Threshold

number

No

The metric value thresholds in the multi-metric alert rule. When thresholds are reached the specified number of times within the specified period, a scaling rule is executed.

40.0

ExpressionsLogicOperator

string

No

The logical relationship between trigger conditions in the multi-metric alert rule. Valid values:

  • &&: An alert is triggered only if all metrics in the multi-metric alert rule meet the trigger conditions. In this case, an alert is triggered only if the results of all trigger conditions that are specified in the multi-metric alert rule are true.

  • ||: An alert is triggered if one of the metrics in the multi-metric alert rule meets the trigger condition.

Default value: &&.

&&

Response elements

Element

Type

Description

Example

object

AlarmTaskId

string

The ID of the event-triggered task.

asg-bp1hvbnmkl10vll5****_83948190-acdd-483f-98f7-b77f4778****

RequestId

string

The ID of the request.

BACACF83-7070-4953-A8FD-D81F89F1****

Examples

Success response

JSON format

{
  "AlarmTaskId": "asg-bp1hvbnmkl10vll5****_83948190-acdd-483f-98f7-b77f4778****",
  "RequestId": "BACACF83-7070-4953-A8FD-D81F89F1****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.