Creates or modifies an event-triggered alert rule.

  • If the specified rule name does not exist, the operation creates an event-triggered alert rule.
  • If the specified rule name exists, the operation modifies the specified event-triggered alert rule.

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 CloudMonitor

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

Note For more information, see DescribeSystemEventMetaList.
RuleName String Yes myRuleName

The name of the event-triggered alert rule.

GroupId String No 12345

The ID of the application group.

EventType String No SYSTEM

The type of the event. Valid values:

  • SYSTEM
  • CUSTOM
Description String No My 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
  • DISABLED
EventPattern.N.NameList.N RepeatList No Agent_Status_Stopped

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

Note For more information, see DescribeSystemEventMetaList.
EventPattern.N.StatusList.N RepeatList No Failed

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

Note For more information, see DescribeSystemEventMetaList.
EventPattern.N.LevelList.N RepeatList No CRITICAL

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

  • CRITICAL
  • WARN
  • INFO
  • *: all levels
EventPattern.N.EventTypeList.N RepeatList No Exception

The type of the event that trigger alerts. Valid values of N: 1 to 50. If all types of events can trigger alerts, set the value to *.

Note For more information, see DescribeSystemEventMetaList.

Response parameters

Parameter Type Example Description
RequestId String 0B963550-5605-4AC6-93D9-FA7644D19FEF

The ID of the request.

Code String 200

The HTTP status code.

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

Indicates whether the call was successful. The value true indicates a success. The value false indicates a failure.

Data String 1

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

Message String The Request is not authorization.

The returned message.

Examples

Sample requests

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

Sample success responses

XML format

<PutEventRule>
          <RequestId>242F6D7B-DCE3-4557-AF08-AB967F6F2EB1</RequestId>
          <Data>1</Data>
          <Code>200</Code>
          <Success>true</Success>
</PutEventRule>

JSON format

{
    "RequestId": "242F6D7B-DCE3-4557-AF08-AB967F6F2EB1",
    "Data": "1",
    "Code": "200",
    "Success": true
}

Error codes

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