Creates or modifies an event-based alert rule by calling the PutEventRule operation.
Operation description
If the Event-triggered Alert Rule name does not exist, a new alert rule is created. If the Event-triggered Alert Rule name already exists, the existing alert rule is modified.
This topic provides an example of how to create an event-based alert rule named myRuleName for the Alibaba Cloud service ecs.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cms:PutEventRule |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RuleName |
string |
Yes |
The name of the Event-triggered Alert Rule. |
myRuleName |
| GroupId |
string |
No |
The ID of the application group to which the Event-triggered Alert Rule belongs. |
7378**** |
| EventType |
string |
No |
The type of the Event-triggered Alert Rule. Valid values:
|
SYSTEM |
| Description |
string |
No |
The description of the Event-triggered Alert Rule. |
Event alert test |
| State |
string |
No |
The status of the Event-triggered Alert Rule. Valid values:
|
ENABLED |
| EventPattern |
array<object> |
Yes |
The pattern of the Event-triggered Alert Rule. |
|
|
object |
No |
None. |
||
| EventTypeList |
array |
No |
The type of the Event-triggered Alert Rule. Valid values of N: 1 to 50. Valid values:
|
Exception |
|
string |
No |
The type of the Event-triggered Alert Rule. Valid values of N: 1 to 50. Valid values:
|
Exception |
|
| StatusList |
array |
No |
The status of the Event-triggered Alert Rule. Valid values of N: 1 to 50. |
Failed |
|
string |
No |
The status of the Event-triggered Alert Rule. Valid values of N: 1 to 50. |
Failed |
|
| Product |
string |
Yes |
The Alibaba Cloud service type. Valid values of N: 1 to 50. Note
For information about the Alibaba Cloud services supported by Event-triggered Alert Rules, see DescribeSystemEventMetaList. |
ecs |
| LevelList |
array |
No |
The level of the Event-triggered Alert Rule. Valid values of N: 1 to 50. Valid values:
|
CRITICAL |
|
string |
No |
The level of the Event-triggered Alert Rule. Valid values of N: 1 to 50. Valid values:
|
CRITICAL |
|
| NameList |
array |
No |
The name of the Event-triggered Alert Rule. Valid values of N: 1 to 50. |
Agent_Status_Stopped |
|
string |
No |
The name of the Event-triggered Alert Rule. Valid values of N: 1 to 50. |
Agent_Status_Stopped |
|
| CustomFilters |
string |
No |
The keyword for event filtering. When the event content contains this keyword, an alert is automatically triggered. |
Stopping |
| SQLFilter |
string |
No |
The SQL filter for events. When the event content meets the SQL condition, an alert is automatically triggered. Note
The syntax of the SQL event filter is consistent with the query syntax of Simple Log Service (SLS). |
192.168.XX.XX and Executed |
| SilenceTime |
integer |
No |
The mute period. Unit: seconds. |
86400 |
For more information about common request parameters, see Common parameters.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The status code. Note
A value of 200 indicates success. |
200 |
| Message |
string |
The error message. |
The Request is not authorization. |
| Data |
string |
The number of rows affected when the Event-triggered Alert Rule is created or modified. |
1 |
| RequestId |
string |
The request ID. |
0B47C47B-E68A-4429-BB23-370E91889C7D |
| Success |
boolean |
Indicates whether the operation was successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"Code": "200",
"Message": "The Request is not authorization.",
"Data": "1",
"RequestId": "0B47C47B-E68A-4429-BB23-370E91889C7D",
"Success": true
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | %s | %s | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | %s | %s |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.