Modifies an event-triggered task.

Description

If you set MetricType to custom, you must first publish the custom metric to CloudMonitor before you can create an event-triggered task for the metric. For more information, see Custom monitoring event-triggered tasks.

When you create an event-triggered task, you must configure the MetricName, Dimension.N.DimensionKey, and Dimension.N.DimensionValue parameters to specify the range of aggregated statistics about metrics of the scaling group that you specified. For example, if user_id and scaling_group are specified, the statistics about the metrics of all the Elastic Compute Service (ECS) instances in the specified scaling group within the specified account is aggregated. The following table describes the metrics that are available when MetricType is set to system.

Note
  • The user_id and scaling_group dimensions are automatically populated. You need only to configure the device and state dimensions. For more information, see the Dimension.N.DimensionKey and Dimension.N.DimensionValue parameters in the "Request parameters" section of this topic.
  • If you set MetricType to custom, the available metrics vary based on the custom metrics that you have.

Collection source

Metric

Description

Dimension

Applicable network

ECS instances

CpuUtilization

The CPU utilization. Unit: %.

user_id and scaling_group

Virtual Private Cloud (VPC) and classic network

ECS instances

IntranetTx

The outbound traffic over the internal network. Unit: KB/min.

user_id and scaling_group

VPC and classic network

ECS instances

IntranetRx

The inbound traffic over the internal network. Unit: KB/min.

user_id and scaling_group

VPC and classic network

ECS instances

VpcInternetTx

The outbound traffic over the Internet from the VPC. Unit: KB/min.

user_id and scaling_group

VPC

ECS instances

VpcInternetRx

The inbound traffic over the Internet to the VPC. Unit: KB/min.

user_id and scaling_group

VPC

ECS instances

ClassicInternetTx

The outbound traffic over the Internet from the classic network. Unit: KB/min.

user_id and scaling_group

Classic network

ECS instances

ClassicInternetRx

The inbound traffic over the Internet to the classic network. Unit: KB/min.

user_id and scaling_group

Classic network

ECS instances

SystemDiskReadBps

The number of bytes read from the system disk per second.

user_id and scaling_group

VPC and classic network

ECS instances

SystemDiskWriteBps

The number of bytes written to the system disk per second.

user_id and scaling_group

VPC and classic network

ECS instances

SystemDiskReadOps

The number of read operations on the system disk per second.

user_id and scaling_group

VPC and classic network

ECS instances

SystemDiskWriteOps

The number of write operations on the system disk per second.

user_id and scaling_group

VPC and classic network

CloudMonitor agents

CpuUtilizationAgent

The CPU utilization. Unit: %.

user_id and scaling_group

VPC and classic network

CloudMonitor agents

GpuUtilizationAgent

The GPU utilization. Unit: %.

user_id and scaling_group

VPC

CloudMonitor agents

GpuMemoryFreeUtilizationAgent

The percentage of idle GPU memory.

user_id and scaling_group

VPC

CloudMonitor agents

GpuMemoryUtilizationAgent

The GPU memory utilization. Unit: %.

user_id and scaling_group

VPC

CloudMonitor agents

MemoryUtilization

The memory utilization. Unit: %.

user_id and scaling_group

VPC and classic network

CloudMonitor agents

LoadAverage

The average system load.

user_id and scaling_group

VPC and classic network

CloudMonitor agents

TcpConnection

The total number of TCP connections.

user_id, scaling_group, and state

VPC and classic network

CloudMonitor agents

PackagesNetOut

The number of packets that are sent by the network interface controller (NIC) per second.

user_id, scaling_group, and device

VPC and classic network

CloudMonitor agents

PackagesNetIn

The number of packets that are received by the NIC per second.

user_id, scaling_group, and device

VPC and classic network

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyAlarm

The operation that you want to perform. Set the value to ModifyAlarm.

AlarmTaskId String Yes asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****

The ID of the event-triggered task.

RegionId String Yes cn-qingdao

The ID of the region to which the event-triggered task belongs.

Name String No alarmtask****

The name of the event-triggered task.

Description String No Test alarm task.

The description of the event-triggered task.

AlarmAction.N RepeatList No ari:acs:ess:cn-hangzhou:140692647****:scalingrule/asr-bp163l21e07uhn****

The unique identifier of scaling rule N that is associated with the event-triggered task.

MetricName String No MemoryUtilization

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

  • If you set MetricType to custom, the valid values are the metrics that you have.
  • If you set MetricType to system, the following values are valid:
    • CpuUtilization
    • IntranetTx
    • IntranetRx
    • VpcInternetTx
    • VpcInternetRx
    • ClassicInternetTx
    • ClassicInternetRx
    • SystemDiskReadBps
    • SystemDiskWriteBps
    • SystemDiskReadOps
    • SystemDiskWriteOps
    • CpuUtilizationAgent
    • GpuUtilizationAgent
    • GpuMemoryFreeUtilizationAgent
    • GpuMemoryUtilizationAgent
    • MemoryUtilization
    • LoadAverage
    • TcpConnection
    • PackagesNetOut
    • PackagesNetIn

For more information, see Description in this topic.

MetricType String No system

The type of the metric. Valid values:

  • system: the system metrics of CloudMonitor
  • custom: the custom metrics that are published to CloudMonitor
Period Integer No 300

The period of time during which statistics about the metric is collected. Unit: seconds. Valid values:

  • 60
  • 120
  • 300
  • 900
Statistics String No Average

The method that is used to collect statistics about the metric. Valid values:

  • Average
  • Minimum
  • Maximum
Threshold Float No 80

The threshold of the metric. If the threshold is reached, a scaling rule is triggered.

ComparisonOperator String No >=

The operator that is used to compare the metric value and the threshold.

  • Valid value if the metric value is greater than or equal to the threshold: >=
  • Valid value if the metric value is less than or equal to the threshold: <=
  • Valid value if the metric value is greater than the threshold: >
  • Valid value if the metric value is less than the threshold: <
EvaluationCount Integer No 3

The number of times that the threshold must be reached to trigger an alert and execute scaling rules. For example, if this parameter is set to 3, an alert is triggered when the average CPU utilization is greater than or equal to 80% for three times.

GroupId Integer No 4055401

The ID of the application group to which the custom metric belongs. This parameter is required only if you set MetricType to custom.

Dimension.N.DimensionKey String No device

The key of dimension N that is associated with the metric. The valid values vary based on the metric type.

  • If you set MetricType to custom, you can specify the valid values as you want.
  • If you set MetricType to system, the following values are valid:
    • user_id: the ID of your account.
    • scaling_group: the scaling group that is monitored
    • device: the type of the NIC
    • state: the status of the TCP connection.
Dimension.N.DimensionValue String No eth0

The value of dimension N that is associated with the metric. The valid values vary based on the value of Dimension.N.DimensionKey.

  • If the value of Dimension.N.DimensionKey is a custom value or if you set MetricType to custom, you can specify the valid values as you want.
  • If the value of Dimension.N.DimensionKey is specified by the system or if you set MetricType to system, the following values are valid:
    • user_id: The system automatically fills in the value.
    • scaling_group: The system automatically fills in the value.
    • device: You can specify eth0 or eth1.
      • For instances of the classic network type, eth0 specifies the internal NIC. Only one eth0 NIC exists on each instance of the VPC type.
      • For instances of the classic network type, eth1 specifies the public NIC.
    • state: You can specify TCP_TOTAL or ESTABLISHED.
      • TCP_TOTAL specifies the total number of TCP connections.
      • ESTABLISHED specifies the number of TCP connections that are established.
Effective String No TZ=+00 * * 1-2 * * ?

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 the format:

  • X is a placeholder for a field, which represents seconds, minutes, hours, day of month, 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.
  • ? indicates that no value is specified.
Note By default, the value of this parameter is specified in UTC+8. You can specify the time zone before a Cron expression in the TZ=+yy format. y indicates the time zone. For example, TZ=+00 * * 1-2 * * ? indicates that the event-triggered task is effective between 01:00 and 02:59 (UTC+0) every day.

Sample values:

  • * * * * * ? : The event-triggered task is effective all the time.
  • * * 17-18 * * ? : The event-triggered task is effective between 17:00 and 18:59 (UTC+8) every day.
  • TZ=+00 * * 1-2 * * ?: The event-triggered task is effective between 01:00 and 02:59 (UTC+0) every day.

Response parameters

Parameter Type Example Description
AlarmTaskId String asg-bp1hvbnmkl10vll5****_83948190-acdd-483f-98f7-b77f4778****

The ID of the event-triggered task.

RequestId String BACACF83-7070-4953-A8FD-D81F89F1****

The ID of the request.

Examples

Sample requests

https://ess.aliyuncs.com/?Action=ModifyAlarm
&RegionId=cn-qingdao
&AlarmTaskId=asg-bp1hvbnmkl10vll5****_83948190-acdd-483f-98f7-b77f4778****
&MetricName=MemoryUtilization
&<Common request parameters>

Sample success responses

XML format

<ModifyAlarmResponse>
    <AlarmTaskId>asg-bp1hvbnmkl10vll5****_83948190-acdd-483f-98f7-b77f4778****</AlarmTaskId>
    <RequestId>BACACF83-7070-4953-A8FD-D81F89F1****</RequestId>
</ModifyAlarmResponse>

JSON format

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

Error codes

For a list of error codes, visit the API Error Center.