Modifies an event-triggered task.
Operation description
-
If you set the MetricType parameter to custom, you must report your custom metrics to CloudMonitor before you can create event-triggered tasks by using the custom metrics. For more information, see Custom monitoring event-triggered tasks.
-
When you create an event-triggered task, you must specify the MetricName, DimensionKey, and DimensionValue parameters to determine the range of statistics that you want to aggregate for the metrics of the scaling group. For example, you can specify the user_id and scaling_group dimensions for an event-triggered task to aggregate monitoring data of all Elastic Compute Service (ECS) instances or elastic container instances in a scaling group within an Alibaba Cloud account.
- If you set the MetricType parameter to custom, the valid values are your custom metrics.
- For information about the metrics that are supported if you set the MetricType parameter to system, see Event-triggered task for system monitoring.
DimensionKey
and DimensionValue
parameters in the "Request parameters" section of this topic.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ess:ModifyAlarm | update | *All Resources * |
| 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.
For more information, see Event-triggered task for system monitoring. | MemoryUtilization |
MetricType | string | No | The type of the metric. Valid values:
| system |
Period | integer | No | The period of time during which statistics about the metric is collected. Unit: seconds. Valid values:
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 method that is used to aggregate statistics for the metric. Valid values:
| Average |
Threshold | float | No | The thresholds of the metric values in the multi-metric alert rule. If the thresholds are reached the specified number of times within the specified period, a scaling rule is executed. | 80 |
ComparisonOperator | string | No | The operator that is used to compare the metric value and the threshold. Valid values:
| >= |
EvaluationCount | integer | No | The number of times that the threshold must be reached before a scaling rule can be 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 ID of the application group to which the custom metric belongs. If you set the MetricType parameter to custom, you must specify this parameter. | 4055401 |
Effective | string | No | The effective period of the event-triggered task. This parameter follows the cron expression format. The default format is
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:
| TZ=+00 * * 1-2 * * ? |
AlarmActions | array | No | The list of unique identifiers of the scaling rules that are associated with the event-triggered task. | |
string | No | The list of unique identifiers of the scaling rules that are associated with the event-triggered task. | ari:acs:ess:cn-hangzhou:140692647****:scalingrule/asr-bp163l21e07uhn**** | |
Dimensions | array<object> | No | Details of the dimensions. | |
object | No | Details of the dimensions. | ||
DimensionKey | string | No | The key of the dimension. The valid values vary based on the metric type.
| device |
DimensionValue | string | No | The value of the dimension. The valid values vary based on the value of the DimensionKey parameter.
| eth0 |
Expressions | array<object> | No | The expressions that are specified in the multi-metric alert rule. | |
object | No | The expressions that are specified in the multi-metric alert rule. | ||
MetricName | string | No | The name of the metric that is specified in the multi-metric alert rule. The valid values vary based on the metric type.
For more information, see Event-triggered task for system monitoring. | CpuUtilization |
ComparisonOperator | string | No | The operator that is used to compare the metric value and the threshold. Valid values:
Default value: >=. | >= |
Period | integer | No | The period of time during which statistics about the metrics in the multi-metric alert rule is collected. Unit: seconds. Valid values:
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 method that is used to aggregate statistics about the metrics that are specified in the multi-metric alert rule. Valid values:
| Average |
Threshold | float | No | The thresholds of the metric values in the multi-metric alert rule. If the thresholds are reached the specified number of times within the specified period, a scaling rule is executed. | 40.0 |
ExpressionsLogicOperator | string | No | The relationship between the trigger conditions in the multi-metric alert rule. Valid values:
Default value: | && |
Response parameters
Examples
Sample success responses
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 Service error codes.
Change history
Change time | Summary of changes | Operation |
---|