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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes PutEventRule

The operation that you want to perform. Set the value to PutEventRule.

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.
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:

  • SYSTEM: system event-triggered alert rule
  • CUSTOM: custom event-triggered alert rule
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:

  • ENABLED: enabled
  • DISABLED: disabled
Long No

The mute period during which new alerts are not sent even if the trigger conditions are met. Unit: seconds.

EventPattern.N.EventTypeList.N RepeatList No Exception

The type of the event-triggered alert rule. Valid values of N: 1 to 50. Valid values:

  • StatusNotification: fault notifications
  • Exception: exceptions
  • Maintenance: O&M
  • *: all types
EventPattern.N.StatusList.N RepeatList No Failed

The status of the event-triggered alert rule. Valid values of N: 1 to 50.

EventPattern.N.LevelList.N RepeatList No CRITICAL

The level of the event-triggered alert rule. Valid values of N: 1 to 50. Valid values:

  • CRITICAL: critical
  • WARN: warning
  • INFO: information
  • *: all levels
EventPattern.N.NameList.N RepeatList 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.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String 0B47C47B-E68A-4429-BB23-370E91889C7D

The ID of the request.

Code String 200

The HTTP status code.

Note The status code 200 indicates that the call is successful.
Success Boolean true

Indicates whether the call is successful. Valid values:

  • true: The call is successful.
  • false: The call fails.
Data String 1

The number of event-triggered alert rules that were created or modified.

Message String The Request is not authorization.

The error message.

Examples

Sample requests

http(s)://[Endpoint]/?Action=PutEventRule
&EventPattern.1.Product=ecs
&RuleName=myRuleName
&<Common request parameters>

Sample success responses

XML format

<PutEventRuleResponse>
		  <RequestId>0B47C47B-E68A-4429-BB23-370E91889C7D</RequestId>
		  <Data>1</Data>
		  <Code>200</Code>
		  <Success>true</Success>
</PutEventRuleResponse>

JSON format

{
	"RequestId": "0B47C47B-E68A-4429-BB23-370E91889C7D",
	"Data": "1",
	"Code": "200",
	"Success": true
}

Error codes

For a list of error codes, visit the API Error Center.