Creates or modifies an event-triggered alert rule.
If the specified rule name does not exist, an event-triggered alert rule is created. If the specified rule name exists, the specified event-triggered alert rule is modified.
In this example, the myRuleName
alert rule is created for the ecs
cloud service.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | PutEventRule |
The operation that you want to perform. Set the value to PutEventRule. |
RuleName | String | Yes | myRuleName |
The name of the event-triggered alert rule. |
GroupId | String | No | 7378**** |
The ID of the application group to which the event-triggered alert rule belongs. |
EventType | String | No | SYSTEM |
The type of the event-triggered alert rule. Valid values:
|
Description | String | No | Event alert test |
The description of the event-triggered alert rule. |
State | String | No | ENABLED |
The status of the event-triggered alert rule. Valid values:
|
EventPattern.N.EventTypeList.N | String | No | Exception |
The type of the event-triggered alert rule. Valid values of N: 1 to 50. Valid values:
|
EventPattern.N.StatusList.N | String | No | Failed |
The status of the event-triggered alert rule. Valid values of N: 1 to 50. |
EventPattern.N.Product | String | Yes | ecs |
The type of the cloud service. Valid values of N: 1 to 50. Note You can call the DescribeSystemEventMetaList operation to query the cloud services
that support event-triggered alerts. For more information, see DescribeSystemEventMetaList.
|
EventPattern.N.LevelList.N | String | No | CRITICAL |
The level of the event-triggered alert rule. Valid values of N: 1 to 50. Valid values:
|
EventPattern.N.NameList.N | String | No | Agent_Status_Stopped |
The name of the event-triggered alert rule. Valid values of N: 1 to 50. |
EventPattern.N.CustomFilters | String | No | Stopping |
The keyword that is used to filter events. If the content of an event contains the specified keyword, an alert is automatically triggered. |
EventPattern.N.SQLFilter | String | No | 192.168.XX.XX and Executed |
The SQL condition that is used to filter events. If the content of an event meets the specified SQL condition, an alert is automatically triggered. Note The syntax of SQL event filtering is consistent with the query syntax of Log Service.
|
SilenceTime | Long | No | 86400 |
The mute period during which new alerts are not sent even if the trigger conditions are met. Unit: seconds. |
For more information about common request parameters, see Common parameters.
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 | The Request is not authorization. |
The error message. |
Data | String | 1 |
The number of event-triggered alert rules that were created or modified. |
RequestId | String | 0B47C47B-E68A-4429-BB23-370E91889C7D |
The ID of the request. |
Success | Boolean | true |
Indicates whether the call was successful. Valid values:
|
Examples
Sample requests
http(s)://[Endpoint]/?Action=PutEventRule
&EventPattern.1.Product=ecs
&RuleName=myRuleName
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<PutEventRuleResponse>
<RequestId>0B47C47B-E68A-4429-BB23-370E91889C7D</RequestId>
<Data>1</Data>
<Code>200</Code>
<Success>true</Success>
</PutEventRuleResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "0B47C47B-E68A-4429-BB23-370E91889C7D",
"Data" : "1",
"Code" : "200",
"Success" : true
}
Error codes
For a list of error codes, see Service error codes.