Queries the monitoring data of a metric for a specified cloud service.
Operation description
Limits
Each API operation can be called up to 10 times per second. An Alibaba Cloud account and the RAM users within the account share the quota.
Description
{"instanceId": "i-abcdefgh12****"}
to aggregate all data of your Alibaba Cloud account.
This topic provides an example to show how to query the monitoring data of the cpu_idle
metric for Elastic Compute Service (ECS). The namespace of ECS is acs_ecs_dashboard
.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Namespace | string | Yes | The namespace of the cloud service. For more information about the namespaces of cloud services, see Appendix 1: Metrics. | acs_ecs_dashboard |
MetricName | string | Yes | The metric that is used to monitor the cloud service. For more information about the metrics of cloud services, see Appendix 1: Metrics. | cpu_idle |
Period | string | No | The statistical period of the metric. Valid values: 15, 60, 900, and 3600. Unit: seconds. Note
| 60 |
StartTime | string | No | The start of the time range to query monitoring data.
The following formats are supported:
Note
| 1618368900000 |
EndTime | string | No | The end of the time range to query monitoring data.
The following formats are supported:
Note
We recommend that you use UNIX timestamps to prevent time zone-related issues.
| 1618368960000 |
Dimensions | string | No | The dimensions based on which the resources are queried. Set the value to a collection of key-value pairs. A typical key-value pair is Note
You can query a maximum of 50 instances in a single request.
| [{"instanceId": "i-abcdefgh12****"}] |
Express | string | No | The expression that is used to compute the query results in real time. Note
Only the groupby expression is supported. This expression is similar to the GROUP BY statement that is used in databases.
| {"groupby":["userId","instanceId"]} |
Length | string | No | The number of entries per page. Default value: 1000. Note
The maximum value of the Length parameter in a request is 1440.
| 1000 |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"Code": "200",
"Message": "The specified resource is not found.",
"RequestId": "6A5F022D-AC7C-460E-94AE-B9E75083D027",
"Datapoints": "[{\\\"timestamp\\\":1618368900000,\\\"Average\\\":95.8291666666667,\\\"Minimum\\\":65.48,\\\"Maximum\\\":100.0},{\\\"timestamp\\\":1618368960000,\\\"Average\\\":95.8683333333333,\\\"Minimum\\\":67.84,\\\"Maximum\\\":100.0}]",
"Period": "60"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | ParameterInvalid | Illegal parameters. | - |
403 | AccessForbidden | User not authorized to operate on the specified resource. | - |
404 | ResourceNotFound | The specified resource is not found. | The specified resource is not found. |
500 | InternalError | The request processing has failed due to some unknown error. | - |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
2024-01-23 | The Error code has changed | see changesets | ||||||||||
|