Creates an event-triggered task
Use the CreateAlarm operation to create an event-triggered task for a scaling group.
Description
This example uses the following parameters to create an event-triggered task:
-
ScalingGroupId: the ID of the scaling group to associate with the event-triggered task.
-
MetricName: the name of the metric. Valid values vary based on the metric type.
-
MetricType: the type of the metric.
-
Period: the collection period for metric data. Unit: seconds.
-
Statistics: the method used to aggregate metric data. Valid values: Average, Minimum, and Maximum.
-
Threshold: the metric threshold. When the threshold is reached the specified number of times, a scaling rule is executed.
-
ComparisonOperator: the operator used to compare the aggregated metric value against the threshold. For example, >= specifies that the metric value is greater than or equal to the threshold.
For more information, see CreateAlarm.
Sample requests
http(s)://ess.aliyuncs.com/?Action=CreateAlarm
&RegionId=cn-hangzhou
&Name=TestAlarmTask
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&MetricName=CpuUtilization
&MetricType=system
&Period=300
&Statistics=Average
&Threshold=80.0
&ComparisonOperator=>=
&<Common request parameters>
Sample responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateAlarmResponse>
<AlarmTaskId>asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****</AlarmTaskId>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</CreateAlarmResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"AlarmTaskId" : "asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****",
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}