Creates an alert rule for a performance metric of a resource.
For more information about how to assign values to the Namespace
, MetricName
, and Dimensions
parameters for cloud services, see DescribeMetricMetaList or Appendix 1: Metrics.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | PutResourceMetricRule |
The operation that you want to perform. Set the value to PutResourceMetricRule. |
ContactGroups | String | Yes | Default alert group |
The alert group. Note Separate multiple alert groups with commas (,).
|
MetricName | String | Yes | cpu_total |
The name of the metric. Note For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
|
Namespace | String | Yes | acs_ecs_dashboard |
The namespace of the service. Note For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
|
Resources | String | Yes | [{"instanceId":"xxxxxxx"}] |
The resource for which the alert rule is to be configured. Note For more information, see
Dimensions for the corresponding metric in Appendix 1: Metrics.
|
RuleId | String | Yes | a151cd6023eacee2f0978e03863cc1697c89508**** |
The ID of the alert rule. Note The ID is generated by the caller. You can specify an existing ID to modify the corresponding
alert rule or specify a new ID to create an alert rule.
|
RuleName | String | Yes | My alert rule |
The name of the alert rule. |
Webhook | String | No | http://www.aliyun.com |
The callback URL to which a POST request is sent when an alert is triggered based on the alert rule. |
EffectiveInterval | String | No | 00:00-23:59 |
The time period during which the alert rule is effective. |
NoEffectiveInterval | String | No | 00:00-06:00 |
The time period during which the alert rule is ineffective. |
SilenceTime | Integer | No | 86400 |
The mute period during which new alerts are not reported even if the alert trigger conditions are met. Unit: seconds. Default value: 86400 (1 day). Note Only one alert is reported during each mute period even if the metric value consecutively
exceeds the alert rule threshold several times.
|
Interval | String | No | 60 |
The interval at which Cloud Monitor checks whether the alert rule is triggered. The default value is the lowest frequency at which the metric is polled. Unit: seconds. Note For more information about the frequency at which monitoring data is collected, see
DescribeMetricMetaList.
|
EmailSubject | String | No | An alert occurs |
The subject of the alert notification email. |
Period | String | No | 60 |
The aggregation cycle of monitoring data. The value is an integral multiple of 60. Unit: seconds. The default value is the frequency at which monitoring data is collected. |
Escalations.Critical.Statistics | String | No | Average |
The statistical method for critical-level alerts. |
Escalations.Critical.ComparisonOperator | String | No | GreaterThanOrEqualToThreshold |
The comparison operator of the threshold for critical-level alerts. Valid values:
|
Escalations.Critical.Threshold | String | No | 90 |
The threshold for critical-level alerts. |
Escalations.Critical.Times | Integer | No | 3 |
The consecutive number of times for which the metric value is measured before a critical-level alert is triggered. |
Escalations.Warn.Statistics | String | No | Average |
The statistical method for warn-level alerts. |
Escalations.Warn.ComparisonOperator | String | No | GreaterThanOrEqualToThreshold |
The comparison operator of the threshold for warn-level alerts. Valid values:
|
Escalations.Warn.Threshold | String | No | 90 |
The threshold for warn-level alerts. |
Escalations.Warn.Times | Integer | No | 3 |
The consecutive number of times for which the metric value is measured before a warn-level alert is triggered. |
Escalations.Info.Statistics | String | No | Average |
The statistical method for info-level alerts. |
Escalations.Info.ComparisonOperator | String | No | GreaterThanOrEqualToThreshold |
The comparison operator of the threshold for info-level alerts. Valid values:
|
Escalations.Info.Threshold | String | No | 90 |
The threshold for info-level alerts. |
Escalations.Info.Times | Integer | No | 3 |
The consecutive number of times for which the metric value is measured before an info-level alert is triggered. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | 200 |
The HTTP status code. Note The status code 200 indicates that the call was successful.
|
Message | String | success |
The returned message. |
RequestId | String | 65D50468-ECEF-48F1-A6E1-D952E89D9436 |
The ID of the request. |
Success | Boolean | true |
Indicates whether the call was successful. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=PutResourceMetricRule
&ContactGroups=Default alert group
&MetricName=cpu_total
&Namespace=acs_ecs_dashboard
&Resources=[{"instanceId":"xxxxxxx"}]
&RuleId=a151cd6023eacee2f0978e03863cc1697c89508****
&RuleName=My alert rule
&<Common request parameters>
Sample success responses
XML
format
<Code>200</Code>
<Message>success</Message>
<RequestId>65D50468-ECEF-48F1-A6E1-D952E89D9436</RequestId>
<Success>true</Success>
JSON
format
{
"Message":"success",
"RequestId":"65D50468-ECEF-48F1-A6E1-D952E89D9436",
"Success":true,
"Code":"200"
}
Error codes
For a list of error codes, visit the API Error Center.