All Products
Search
Document Center

CloudMonitor:PutEventRule

Last Updated:Jul 26, 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

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cms:PutEventRulecreate
  • All Resources
    *
    none
none

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
EventPatternarray<object>Yes
objectYes
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 changedView Change Details