CreateAlarm
Creates an event-triggered task.
Operation description
Operation description
-
If you create an event-triggered task of the custom metric type (MetricType=custom), you must first report custom metric data to CloudMonitor. For more information, see Custom metric event-triggered tasks.
-
When you create an event-triggered task, you must specify a metric (MetricName) and configure dimension information (Dimension.N.DimensionKey and Dimension.N.DimensionValue) to determine the aggregation scope of the metric data in the scaling group. For example, you can specify user_id and scaling_group to aggregate the metric data of all ECS instances or ECI instances under the specified user and scaling group.
Monitoring metrics for custom metric event-triggered tasks (MetricType=custom) depend on your custom metrics.
For more information about monitoring metrics supported by system metric event-triggered tasks (MetricType=system), see System metric event-triggered tasks.
In the dimension information, user_id and scaling_group are automatically populated by the system, while device and state must be manually specified. For more information, see the Dimension.N.DimensionKey and Dimension.N.DimensionValue parameters.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ess:CreateAlarm |
create |
*ScalingGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the scaling group. |
cn-hangzhou |
| Name |
string |
No |
The name of the event-triggered task. |
TestAlarmTask |
| Description |
string |
No |
The description of the event-triggered task. |
Test alarm task. |
| ScalingGroupId |
string |
Yes |
The ID of the scaling group with which the event-triggered task is associated. |
asg-bp18p2yfxow2dloq**** |
| MetricName |
string |
No |
The name of the metric. The valid values vary based on the monitoring type of the event-triggered task:
For more information, see System metric event-triggered tasks. |
CpuUtilization |
| MetricType |
string |
No |
The metric type. Valid values:
|
system |
| Period |
integer |
No |
The statistical period of the metric data. Unit: seconds. Valid values:
Note
A statistical period of 15 seconds is supported only for ECS scaling groups. Default value: 300. |
300 |
| Statistics |
string |
No |
The statistical method for the metric data. Valid values:
Default value: Average. |
Average |
| Threshold |
number |
No |
The threshold of the monitoring metrics. A scaling rule is triggered when the threshold expression is met for the specified number of times. |
80.0 |
| ComparisonOperator |
string |
No |
The comparison operator used to compare the statistical value of the metric with the threshold. Valid values:
Default value: >=. |
>= |
| EvaluationCount |
integer |
No |
The number of times that the threshold expression must be met to trigger a scaling rule. For example, if this parameter is set to 3, the scaling rule is triggered when the average CPU utilization is greater than or equal to 80% for three consecutive times. Default value: 3. |
3 |
| GroupId |
integer |
No |
The ID of the CloudMonitor application group to which the custom metric belongs. This parameter is required only when the metric type is custom. |
4055401 |
| Effective |
string |
No |
The effective period of the event-triggered task. By default, the task is effective at all times. This parameter follows a cron expression. The default format is
Note
The specified value defaults to the UTC+8 time zone. You can add the time zone information Examples:
|
TZ=+00 * * 1-2 * * ? |
| AlarmAction |
array |
No |
The unique identifier of the scaling rule associated with the event-triggered task. |
ari:acs:ess:cn-hangzhou:1406926****:scalingrule/asr-bp163l21e07uhn**** |
|
string |
No |
The unique identifier of the scaling rule associated with the event-triggered task. |
ari:acs:ess:cn-hangzhou:1406926****:scalingrule/asr-bp163l21e07uhn**** |
|
| Dimension |
array<object> |
No |
The list of dimensions associated with the metric. |
|
|
object |
No |
The list of dimensions associated with the metric. |
||
| DimensionKey |
string |
No |
The key of the dimension associated with the metric. The valid values vary based on the monitoring type of the event-triggered task:
|
device |
| DimensionValue |
string |
No |
The value of the dimension associated with the metric. The valid values are determined by Dimension.N.DimensionKey:
|
eth0 |
| Expression |
array<object> |
No |
The information about the multi-metric alert rule. |
|
|
object |
No |
The information about the multi-metric alert rule. |
||
| MetricName |
string |
No |
The name of the monitoring metrics for the multi-metric alert rule. The valid values vary based on the monitoring type of the event-triggered task:
For more information, see System metric event-triggered tasks. |
CpuUtilization |
| ComparisonOperator |
string |
No |
The comparison operator used to compare the statistical value of the metric with the threshold in the multi-metric alert rule. Valid values:
Default value: >=. |
>= |
| Period |
integer |
No |
The statistical period of the metric data in the multi-metric alert rule. Unit: seconds. Valid values:
Note
A statistical period of 15 seconds is supported only for ECS scaling groups. Default value: 300. |
900 |
| Statistics |
string |
No |
The statistical method for the metric data in the multi-metric alert rule. Valid values:
Default value: Average. |
Average |
| Threshold |
number |
No |
The threshold of the monitoring metrics in the multi-metric alert rule. A scaling rule is triggered when the threshold expression is met for the specified number of times. |
40.0 |
| ExpressionsLogicOperator |
string |
No |
The logical operator between multiple monitoring metrics alert conditions. Valid values:
Default value: |
&& |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| AlarmTaskId |
string |
The ID of the event-triggered task. |
asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1**** |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
Examples
Success response
JSON format
{
"AlarmTaskId": "asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.