Creates an application group by using a resource group.

Before you call this operation, make sure that a resource group is created in the Resource Management console. For more information, see Create a resource group.

This operation supports the following cloud services: Elastic Compute Service (ECS), ApsaraDB RDS, Server Load Balancer (SLB), Elastic IP Address (EIP), Anti-DDoS, Alibaba Cloud CDN, EIP Bandwidth Plan, PolarDB, and ApsaraDB for Redis.

This topic provides an example on how to create an application group by using the resource group CloudMonitor and the alert group ECS_Group. The region ID of the resource group is cn-hangzhou.

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 CreateMonitorGroupByResourceGroupId

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

ContactGroupList.N RepeatList Yes ECS_Group

The alert contact group. The alert notifications of the application group are sent to the alert contacts in the alert contact group.

An alert contact group can contain one or more alert contacts. For information about how to create alert contacts and alert contact groups, see PutContact and PutContactGroup. For information about how to obtain alert contact groups, see DescribeContactGroupList.

RegionId String Yes cn-hangzhou

The ID of the region where the resource group resides.

For information about how to obtain the ID of the region where a resource group resides, see GetResourceGroup.

ResourceGroupId String Yes rg-acfmw3ty5y7****

The ID of the resource group.

For information about how to obtain the ID of a resource group, see ListResourceGroups.

ResourceGroupName String Yes CloudMonitor

The name of the resource group.

For information about how to obtain the name of a resource group, see ListResourceGroups.

EnableSubscribeEvent Boolean No true

Specifies whether the application group automatically subscribes to event notifications. If events whose severity level is critical or warning occur on resources in an application group, CloudMonitor sends alert notifications. Valid values:

  • true: The application group automatically subscribes to event notifications.
  • false: The application group does not automatically subscribe to event notifications. This is the default value.
EnableInstallAgent Boolean No true

Specifies whether the CloudMonitor agent is automatically installed for the application group. CloudMonitor determines whether to automatically install the CloudMonitor agent for the hosts in an application group based on the value of this parameter. Valid values:

  • true: The CloudMonitor agent is automatically installed.
  • false: The CloudMonitor agent is not automatically installed. This is the default value.

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

Response parameters

Parameter Type Example Description
Code String 200

The HTTP status code.

Note The value 200 indicates that the call was successful.
Id Long 12345678

The ID of the application group.

Message String The specified resource is not found.

The error message.

RequestId String 784CAB3C-F613-5BCE-8469-6DCB29B18A20

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=CreateMonitorGroupByResourceGroupId
&ContactGroupList.1=ECS_Group
&RegionId=cn-hangzhou
&ResourceGroupId=rg-acfmw3ty5y7****
&ResourceGroupName=CloudMonitor
&<Common request parameters>

Sample success responses

XML format

<CreateMonitorGroupByResourceGroupIdResponse>
	  <RequestId>784CAB3C-F613-5BCE-8469-6DCB29B18A20</RequestId>
	  <Id>12345678</Id>
	  <Code>200</Code>
	  <Success>true</Success>
</CreateMonitorGroupByResourceGroupIdResponse>

JSON format

{
    "RequestId": "784CAB3C-F613-5BCE-8469-6DCB29B18A20",
    "Id": 12345678,
    "Code": 200,
    "Success": true
}

Error codes

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

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