All Products
Search
Document Center

CloudMonitor:PutEventRule

Last Updated:Mar 01, 2024

Operation description

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.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RuleNamestringYes

The name of the event-triggered alert rule.

myRuleName
GroupIdstringNo

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

7378****
EventTypestringNo

The type of the event-triggered alert rule. Valid values:

  • SYSTEM: system event-triggered alert rule
  • CUSTOM: custom event-triggered alert rule
SYSTEM
DescriptionstringNo

The description of the event-triggered alert rule.

StatestringNo

The status of the event-triggered alert rule. Valid values:

  • ENABLED: enabled
  • DISABLED: disabled
ENABLED
EventPatternobject []Yes
EventTypeListarrayNo
stringNo

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
Exception
StatusListarrayNo
stringNo

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

Failed
ProductstringYes

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 .
ecs
LevelListarrayNo
stringNo

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
CRITICAL
NameListarrayNo
stringNo

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

Agent_Status_Stopped
CustomFiltersstringNo

The keyword that is used to filter events. If the content of an event contains the specified keyword, an alert is automatically triggered.

Stopping
SQLFilterstringNo

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.
192.168.XX.XX and Executed
SilenceTimelongNo

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

86400

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

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The HTTP status code.

Note The status code 200 indicates that the call was successful.
200
Messagestring

The error message.

The Request is not authorization.
Datastring

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

1
RequestIdstring

The ID of the request.

0B47C47B-E68A-4429-BB23-370E91889C7D
Successboolean

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
true

Examples

Sample success responses

JSONformat

{
  "Code": "200",
  "Message": "The Request is not authorization.",
  "Data": "1",
  "RequestId": "0B47C47B-E68A-4429-BB23-370E91889C7D",
  "Success": true
}

Error codes

HTTP status codeError codeError message
400%s%s
500InternalErrorThe request processing has failed due to some unknown error.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2021-12-24The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 500