Queries the monitoring data of a metric for a specified cloud service.
Operation description
Limits
Each API operation can be called up to 50 times per second. An Alibaba Cloud account and the RAM users within the account share the quota.
cpu_idle
metric for Elastic Compute Service (ECS). The namespace of ECS is acs_ecs_dashboard
. The returned result indicates that the monitoring data for the instance i-abcdefgh12****
of the account 120886317861****
is queried at an interval of 60 seconds. The maximum, minimum, and average values of the metric are 100, 93.1, and 99.52.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
cms:QueryMetricList | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Namespace | string | Yes | The namespace of the cloud service. Format: acs_service name. For more information about the namespaces of cloud services, see Appendix 1: Metrics. | acs_ecs_dashboard |
MetricName | string | Yes | The name of the metric. For more information about metric names, see Appendix 1: Metrics. | cpu_idle |
Period | string | No | The interval at which the monitoring data is queried. Valid values: 60, 300, and 900. Unit: seconds. Note
Configure this parameter based on your business scenario.
| 60 |
StartTime | string | No | The beginning of the time range to query. The following formats are supported:
Note
The specified period includes the end time and excludes the start time. The start time must be earlier than the end time.
| 2019-01-30 00:00:00 |
EndTime | string | No | The end of the time range to query. The following formats are supported:
| 2019-01-30 00:10:00 |
Dimensions | string | No | The dimensions that specify the resources whose monitoring data you want to query. 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****"}] |
NextToken | string | No | The paging token. Note
If this parameter is not specified, the data on the first page is returned. A return value other than Null of this parameter indicates that not all entries have been returned. You can use this value as an input parameter to obtain entries on the next page. The value Null indicates that all query results have been returned.
| 15761485350009dd70bb64cff1f0fff750b08ffff073be5fb1e785e2b020f1a949d5ea14aea7fed82f01dd8**** |
Length | string | No | The number of entries to return on each page. Note
The maximum value of the Length parameter in a request is 1440.
| 1000 |
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"]} |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"NextToken": "15761441850009dd70bb64cff1f0fff6d0b08ffff073be5fb1e785e2b020f7fed9b5e137bd810a6d6cff5ae****",
"RequestId": "3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42",
"Success": true,
"Datapoints": "[{\"timestamp\":1548777660000,\"userId\":\"120886317861****\",\"instanceId\":\"i-abc\",\"Minimum\":9.92,\"Average\":9.92,\"Maximum\":9.92}]",
"Code": "200",
"Message": "The specified resource is not found.",
"Period": "60"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | %s | %s | - |
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. | - |
500 | InternalError | %s | - |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-03-10 | The Error code has changed | View Change Details |