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 For more information about the cloud services that support event-triggered alerts, see DescribeSystemEventMetaList.
RuleName String Yes myRuleName

The name of the alert rule.

GroupId String No 7378****

The ID of the application group to which the alert rule belongs.

EventType String No SYSTEM

The type of the alert rule. Valid values:

  • SYSTEM: system event-triggered alert rules
  • CUSTOM: custom event-triggered alert rules
Description String No My event alert test

The description of the alert rule.

State String No ENABLED

The status of the alert rule. Valid values:

  • ENABLED: enabled
  • DISABLED: disabled
EventPattern.N.NameList.N RepeatList No Agent_Status_Stopped

The name of the alert rule. Valid values of N: 1 to 50.

EventPattern.N.StatusList.N RepeatList No Failed

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

EventPattern.N.LevelList.N RepeatList No CRITICAL

The level of the alert. Valid values of N: 1 to 50. Valid values:

  • CRITICAL: critical issue
  • WARN: warning
  • INFO: information
  • *: all levels
EventPattern.N.EventTypeList.N RepeatList No Exception

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

  • StatusNotification: fault notifications
  • Exception: exceptions
  • Maintenance: O&M
  • *: all types

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 value 200 indicates that the call was successful.
Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
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.