Creates or modifies an alert rule to dynamically add instances that meet the rule to an application group.

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 PutMonitorGroupDynamicRule

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

GroupId Long Yes 123456

The ID of the application group.

GroupRules.N.Category String Yes ecs

The cloud service to which the alert rule is applied. Valid values of N: 1 to 3. Valid value:

  • ecs: Elastic Compute Service (ECS)
  • rds: ApsaraDB RDS
  • slb: Server Load Balancer (SLB)
GroupRules.N.FilterRelation String Yes and

The logical operator used between conditional expressions in the alert rule. Valid values of N: 1 to 3. Valid value:

  • and: The instances that meet all the conditional expressions are automatically added to the application group.
  • or: The instances that meet one of the conditional expressions are automatically added to the application group.
GroupRules.N.Filters.N.Function String Yes contains

The method that is used to filter instances. Valid values of N: 1 to 3. Valid value:

  • contains: containment relationship
  • startWith: starts with a prefix
  • endWith: ends with a suffix
GroupRules.N.Filters.N.Name String Yes hostName

The name of the field based on which instances are filtered. Valid values of N: 1 to 3.

Only hostnames are supported. Example: hostName.

GroupRules.N.Filters.N.Value String Yes nginx

The value to be matched with the value of the name field. Valid values of N: 1 to 3.

IsAsync Boolean No false

The mode for creating the alert rule. Valid value:

  • true: creates asynchronously
  • false (default value): creates synchronously

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

Response parameters

Parameter Type Example Description
RequestId String 3E73F1AB-D195-438A-BCA7-2F4355789C58

The ID of the request.

Success Boolean true

Indicates whether the call is successful. Valid value:

  • true: The call is successful.
  • false: The call fails.
Code Integer 200

The HTTP status code.

Note The status code 200 indicates that the call is successful.
Message String The specified resource is not found.

The error message.

Examples

Sample requests

http(s)://[Endpoint]/?Action=PutMonitorGroupDynamicRule
&GroupId=123456
&GroupRules.1.Category=ecs
&GroupRules.1.FilterRelation=and
&GroupRules.1.Filters.1.Function=contains
&GroupRules.1.Filters.1.1ame=hostName
&GroupRules.1.Filters.1.Value=nginx
&<Common request parameters>

Sample success responses

XML format

<PutMonitorGroupDynamicRuleResponse>
      <RequestId>3E73F1AB-D195-438A-BCA7-2F4355789C58</RequestId>
      <Success>true</Success>
      <Code>200</Code>
</PutMonitorGroupDynamicRuleResponse>

JSON format

{
  "RequestId": "3E73F1AB-D195-438A-BCA7-2F4355789C58",
  "Success": true,
  "Code": 200
}

Error codes

HttpCode Error code Error message Description
404 ResourceNotFound The specified resource is not found. The error message returned because the specified resource is not found.

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