Installs the CloudMonitor agent on one or more Elastic Compute Service (ECS) instances.

Prerequisites

The Cloud Assistant client is installed on an ECS instance. For more information about how to install the Cloud Assistant client, see Overview.

Background information

This API operation is applicable only to ECS instances.

The success rate of installing the CloudMonitor agent by calling this API operation is about 95%. If the installation fails, manually install the agent on the ECS instance. For more information about how to install the CloudMonitor agent, see Install and uninstall the CloudMonitor agent for C++.

Usage notes

This topic provides an example to show how to install the latest version of the CloudMonitor agent on an ECS instance whose ID is i-m5e0k0bexac8tykr****.

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 InstallMonitoringAgent

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

Force Boolean No true

Specifies whether to install the CloudMonitor agent. Valid values:

  • true (default value): yes
  • false: no
InstanceIds.N String No i-m5e0k0bexac8tykr****

The IDs of the ECS instances.

Valid values of N: 1 to 10.

Note You must specify either the InstallCommand or the InstanceIds parameter.
InstallCommand String No onlyInstallNotHasAgent

Specifies whether to install the CloudMonitor agent on all ECS instances that belong to the current Alibaba Cloud account. Valid values:

  • onlyInstallNotHasAgent: installs the latest version of the CloudMonitor agent only on ECS instances on which the agent is not installed.
  • onlyUpgradeAgent: upgrades the CloudMonitor agent to the latest version only for ECS instances on which an earlier version of the agent is installed.
  • installAndUpgrade: installs the latest version of the CloudMonitor agent on ECS instances on which the agent is not installed, and upgrades the CloudMonitor agent to the latest version for ECS instances on which an earlier version of the agent is installed.
Note If you set the InstallCommand parameter, the InstanceIds parameter does not take effect.

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 status code 200 indicates that the call was successful.
Message String The specified resource is not found.

The error message.

RequestId String 0BDAF8A8-04DC-5F0C-90E4-724D42C41945

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=InstallMonitoringAgent
&Force=true
&InstallCommand=onlyInstallNotHasAgent
&<Common request parameters>

Sample success responses

XML format

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

<InstallMonitoringAgentResponse>
	<RequestId>0BDAF8A8-04DC-5F0C-90E4-724D42C41945</RequestId>
	<Code>200</Code>
	<Success>true</Success>
</InstallMonitoringAgentResponse>

JSON format

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

{
  "RequestId" : "0BDAF8A8-04DC-5F0C-90E4-724D42C41945",
  "Code" : 200,
  "Success" : true
}

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.