Modifies an alert template.
Operation description
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 response shows that the alert template is modified.
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 |
---|---|---|---|---|
cms:ModifyMetricRuleTemplate | update |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TemplateId | long | Yes | The ID of the alert template. For information about how to obtain the ID of an alert template, see DescribeMetricRuleTemplateList . | 123456 |
Name | string | No | The name of the alert template. For information about how to obtain the name of an alert template, see DescribeMetricRuleTemplateList . | test123 |
Description | string | No | The description of the alert template. | ECS_template1 |
RestVersion | long | Yes | 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 . | 0 |
AlertTemplates | array<object> | No | The details of the alert template. | |
object | No | 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 . | ||
Escalations.Info.Threshold | string | No | 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.
| 20 |
MetricName | string | No | The metric name. Valid values of N: 1 to 200. For information about how to obtain metrics, see DescribeMetricMetaList or Appendix 1: Metrics. | cpu_total |
Webhook | string | No | 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. | https://apiwebhook.hipac.cn/api/v1/alarm/aly/eregfeeferrtbnmkdszp |
Escalations.Warn.Threshold | string | No | 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.
| 30 |
Namespace | string | No | 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. | acs_ecs_dashboard |
Period | integer | No | 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.
| 60 |
RuleName | string | No | The name of the alert rule. Valid values of N: 1 to 200. | rule1 |
Escalations.Critical.Times | integer | No | 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.
| 2 |
Selector | string | No | 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 .
| {"disk":"/"} |
Escalations.Info.Statistics | string | No | 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.
| Average |
Escalations.Warn.Times | integer | No | 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.
| 1 |
Escalations.Info.ComparisonOperator | string | No | 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.
| GreaterThanOrEqualToThreshold |
Category | string | No | The abbreviation of the cloud service name. Valid values of N: 1 to 200. For more information about how to obtain the abbreviation of a cloud service name, see | ecs |
Escalations.Critical.Threshold | string | No | 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.
| 30 |
Escalations.Critical.Statistics | string | No | 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.
| Average |
Escalations.Critical.ComparisonOperator | string | No | 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.
| GreaterThanOrEqualToThreshold |
Escalations.Warn.ComparisonOperator | string | No | 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.
| GreaterThanOrEqualToThreshold |
Escalations.Info.Times | integer | No | 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.
| 1 |
Escalations.Warn.Statistics | string | No | 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.
| Average |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"Code": 200,
"Message": "The Request is not authorization.",
"RequestId": "9E07117F-F6AE-4F1C-81E8-36FBB4892235",
"Success": true
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
206 | %s | %s |
400 | InvalidQueryParameter | %s |
401 | AccessDeniedException | You donot have sufficient access to perform this action. |
402 | LimitExceeded | The quota for this customer had been reached. |
403 | InvalidClientTokenId | The X.509 certificate or cms access key ID provided does not exist in our records. |
429 | Throttli∂ngException | The request was denied due to request throttling. |
500 | InternalFailure | %s |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|