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
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.
InstanceIds.N RepeatList No i-m5e0k0bexac8tykr****

The IDs of the ECS instances. Valid values of N: 1 to 10.

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

Response parameters

Parameter Type Example Description
RequestId String 0BDAF8A8-04DC-5F0C-90E4-724D42C41945

The ID of the request.

Code String 200

The HTTP status code.

Note The status code 200 indicates that the call is successful.
Success Boolean true

Indicates whether the call is successful. Valid values:

  • true: The call is successful.
  • false: The call fails.
Message String The specified resource is not found.

The error message.

Examples

Sample requests

http(s)://[Endpoint]/?Action=InstallMonitoringAgent
&InstanceIds.1=i-m5e0k0bexac8tykr****
&<Common request parameters>

Sample success responses

XML format

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

JSON format

{
    "RequestId": "0BDAF8A8-04DC-5F0C-90E4-724D42C41945",
    "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 is not found.

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