Applies an alert template to an application group to generate alert rules.
Operation description
This topic provides an example on how to apply the alert template 700**** to the application group 123456. The ID of the generated alert rule is applyTemplate8ab74c6b-9f27-47ab-8841-de01dc08****, and the name is test123.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cms:ApplyMetricRuleTemplate |
create |
*MetricRuleTemplate
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SilenceTime |
integer |
No |
The mute for. Unit: seconds. Default value: 86400. Note
When monitoring data continuously exceeds the alert rule threshold, only one alert notification is sent within each mute period. |
86400 |
| GroupId |
integer |
Yes |
The ID of the application group. For information about how to obtain the application group ID, see DescribeMonitorGroups. |
123456 |
| TemplateIds |
string |
Yes |
The ID of the alert template. For information about how to obtain the alert template ID, see DescribeMetricRuleTemplateList. |
700**** |
| EnableStartTime |
integer |
No |
The start hour when the alert rule takes effect. The value is a two-digit string (such as "00", "09", or "23") in the range of 00 to 23, representing 00:00 to 23:00. The default time zone is UTC+8. |
00 |
| EnableEndTime |
integer |
No |
The end hour when the alert rule takes effect. The value is a two-digit string (such as "00", "18", or "23") in the range of 00 to 23. The value indicates the hour of the end time, and the actual effective period ends at the 59th minute of that hour (for example, "23" means the rule is effective until 23:59). The default time zone is UTC+8. |
23 |
| NotifyLevel |
integer |
No |
The alert notification method. Valid values: 4: TradeManager + DingTalk chatbot. |
4 |
| ApplyMode |
string |
No |
The mode in which the alert template is applied. Valid values:
|
GROUP_INSTANCE_FIRST |
| Webhook |
string |
No |
The callback URL to which a POST request is sent when an alert is triggered. |
https://www.aliyun.com |
| AppendMode |
string |
No |
The policy for applying the template. Valid values:
|
all |
For more information about common request parameters, see Common parameters.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
integer |
The status code. Note
A value of 200 indicates success. |
200 |
| Message |
string |
The error message. |
The specified resource is not found. |
| RequestId |
string |
The request ID. |
3F897F3C-020A-4993-95B4-63ABB84F83E6 |
| Success |
boolean |
Indicates whether the operation was successful. Valid values:
|
true |
| Resource |
object |
The resources affected by the alert rules. |
|
| GroupId |
integer |
The ID of the application group. |
123456 |
| AlertResults |
array<object> |
The details of the generated alert rules. |
|
|
object |
The details of the generated alert rules. |
||
| Code |
string |
The status code. Note
The value 200 indicates success. |
200 |
| Message |
string |
The returned message. |
alert rule is creating, please wait a few minutes. |
| Success |
boolean |
Indicates whether the operation was successful. Valid values:
|
true |
| RuleName |
string |
The name of the alert rule. |
test123 |
| RuleId |
string |
The ID of the alert rule. |
applyTemplate8ab74c6b-9f27-47ab-8841-de01dc08**** |
Examples
Success response
JSON format
{
"Code": 200,
"Message": "The specified resource is not found.",
"RequestId": "3F897F3C-020A-4993-95B4-63ABB84F83E6",
"Success": true,
"Resource": {
"GroupId": 123456,
"AlertResults": [
{
"Code": "200",
"Message": "alert rule is creating, please wait a few minutes.",
"Success": true,
"RuleName": "test123",
"RuleId": "applyTemplate8ab74c6b-9f27-47ab-8841-de01dc08****"
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | ParameterInvalid | Illegal parameters. | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | AccessForbidden | User not authorized to operate on the specified resource. | |
| 404 | ResourceNotFound | %s |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.