Modifies an alert template.
This topic provides an example on how to modify an alert template whose version is 1
and ID is 123456
. The alert level is changed to Critical
. The statistical method is changed to Average
. The alert threshold comparator is changed to GreaterThanOrEqualToThreshold
. The alert threshold is changed to 90
. The number of alert retries is changed to 3
. The returned result indicates that the alert template is modified.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyMetricRuleTemplate | The operation that you want to perform. Set the value to ModifyMetricRuleTemplate. |
TemplateId | Long | Yes | 123456 | The ID of the alert template. For information about how to obtain the ID of an alert template, see DescribeMetricRuleTemplateList. |
Name | String | No | Template_123 | The name of the alert template. For information about how to obtain the name of an alert template, see DescribeMetricRuleTemplateList. |
Description | String | No | ECS_template1 | The description of the alert template. |
RestVersion | Long | Yes | 1 | The version of the alert template. The version changes with the number of times that the alert template is modified. For information about how to obtain the version of an alert template, see DescribeMetricRuleTemplateList. |
AlertTemplates.N.Escalations.Info.Threshold | String | No | 20 | The threshold for Info-level alerts. Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.MetricName | String | No | cpu_total | The name of the metric. Valid values of N: 1 to 200. For information about how to obtain a metric, see DescribeMetricMetaList or Appendix 1: Metrics. |
AlertTemplates.N.Webhook | String | No | http://www.aliyun.com | The callback URL. Valid values of N: 1 to 200. The callback URL must be accessible over the Internet. CloudMonitor pushes an alert notification to the specified callback URL by sending an HTTP POST request. Only the HTTP protocol is supported. |
AlertTemplates.N.Escalations.Warn.Threshold | String | No | 30 | The threshold for Warn-level alerts. Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Namespace | String | No | acs_ecs_dashboard | The namespace of the cloud service. Valid values of N: 1 to 200. For information about how to obtain the namespace of a cloud service, see DescribeMetricMetaList or Appendix 1: Metrics. |
AlertTemplates.N.Period | Integer | No | 60 | The statistical period of the monitoring data. Valid values of N: 1 to 200. Note If the value is set to 300 seconds, the monitoring data is collected every 300 seconds. If the monitoring data is reported every 1 minute, the alert system calculates the average, maximum, and minimum values of the monitoring data of 5 minutes and checks whether the aggregated values exceed the threshold. To prevent unexpected alerts, we recommend that you set this parameter together with other parameters. |
AlertTemplates.N.RuleName | String | No | Rule_123 | The name of the alert rule. Valid values of N: 1 to 200. |
AlertTemplates.N.Escalations.Critical.Times | Integer | No | 2 | The consecutive number of times for which the metric value meets the alert condition before a Critical-level alert is triggered. Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Selector | String | No | {"disk":"/"} | The dimension of the alert. It is an extended field. Valid values of N: 1 to 200. For example, an alert template is applied to an application group, this parameter is set to Note For more information about the values of extended fields, see DescribeMetricRuleTemplateAttribute. |
AlertTemplates.N.Escalations.Info.Statistics | String | No | Average | The statistical method for Info-level alerts. Valid values of N: 1 to 200. The value of this parameter is determined by the Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Escalations.Warn.Times | Integer | No | 1 | The consecutive number of times for which the metric value meets the alert condition before a Warn-level alert is triggered. Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Escalations.Info.ComparisonOperator | String | No | GreaterThanOrEqualToThreshold | The operator that is used to compare the metric value with the threshold for Info-level alerts. Valid values:
Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Category | String | No | ecs | The abbreviation of the cloud service name. Valid values of N: 1 to 200. For information about how to obtain the abbreviation of a cloud service name, see |
AlertTemplates.N.Escalations.Critical.Threshold | String | No | 30 | The threshold for Critical-level alerts. Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Escalations.Critical.Statistics | String | No | Average | The statistical method for Critical-level alerts. Valid values of N: 1 to 200. The value of this parameter is determined by the Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Escalations.Critical.ComparisonOperator | String | No | GreaterThanOrEqualToThreshold | The operator that is used to compare the metric value with the threshold for Critical-level alerts. Valid values:
Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Escalations.Warn.ComparisonOperator | String | No | GreaterThanOrEqualToThreshold | The operator that is used to compare the metric value with the threshold for Warn-level alerts. Valid values:
Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Escalations.Info.Times | Integer | No | 1 | The consecutive number of times for which the metric value meets the alert condition before an Info-level alert is triggered. Valid values of N: 1 to 200. Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
AlertTemplates.N.Escalations.Warn.Statistics | String | No | Average | The statistical method for Warn-level alerts. Valid values of N: 1 to 200. The value of this parameter is determined by the Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level. |
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | Integer | 200 | The HTTP status code. Note The status code 200 indicates that the call is successful. |
Message | String | The Request is not authorization. | The returned message. |
RequestId | String | 9E07117F-F6AE-4F1C-81E8-36FBB4892235 | The ID of the request. |
Success | Boolean | true | Indicates whether the call is successful. Valid values:
|
Examples
Sample requests
http(s)://[Endpoint]/?Action=ModifyMetricRuleTemplate
&TemplateId=123456
&RestVersion=0
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyMetricRuleTemplateResponse>
<RequestId>97EAC0E2-CD54-4183-95AC-F0C113024E18</RequestId>
<Code>200</Code>
<Success>true</Success>
</ModifyMetricRuleTemplateResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "5F78F035-3369-4360-810E-D5CC5E774336",
"Code" : 200,
"Success" : true
}
Error codes
For a list of error codes, see Service error codes.