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.FilterRelation String Yes and

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

  • 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.Value String Yes nginx

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

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.Function String Yes contains

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

  • contains: contains
  • notContains: excludes
  • startWith: starts with a prefix
  • endWith: ends with a suffix
GroupRules.N.Category String Yes ecs

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

  • ecs: Elastic Compute Service (ECS)
  • rds: ApsaraDB RDS
  • slb: Server Load Balancer (SLB)
IsAsync Boolean No false

The mode for creating the alert rule. Valid values:

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

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

Response parameters

Parameter Type Example Description
Code Integer 200

The HTTP status code.

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

The error message.

RequestId String 3E73F1AB-D195-438A-BCA7-2F4355789C58

The ID of the request.

Success Boolean true

Indicates whether the call was successful. Valid values:

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

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

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HTTP status code 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, see Service error codes.