Call the DescribeMetricList operation to query monitoring data for a specific metric of a cloud service.
Operation description
Limits
You have a free quota of 1 million API calls per month for the DescribeMetricLast, DescribeMetricList, DescribeMetricData, and DescribeMetricTop operations. If you use up the free quota, you cannot call these API operations unless you have enabled the pay-as-you-go billing method for basic CloudMonitor. You are charged for API calls that exceed the free quota. For more information about how to enable the pay-as-you-go billing method, see Enable pay-as-you-go.
You can call each API operation up to 50 times per second. This limit is shared between an Alibaba Cloud account and its RAM users.
If you receive the Throttling.User or Request was denied due to user flow control error message when you call an API operation, it means that the API call is throttled. For more information about how to resolve this issue, see How do I resolve the issue of API call throttling?.
Notes
The storage duration of monitoring data for each cloud service is determined by the Period (statistical period). A larger Period value indicates that the queried monitoring data is less granular and can be stored for a longer period. The following list describes the relationship:
If the value of
Periodis less than 60 seconds, the storage duration is 7 days.If the value of
Periodis 60 seconds, the storage duration is 31 days.If the value of
Periodis 300 seconds or greater, the storage duration is 91 days.
Usage notes
This topic provides an example of how to query the monitoring data of the cpu_idle metric for the acs_ecs_dashboard cloud service. The response shows that for the instance i-abcdefgh12**** that belongs to the Alibaba Cloud account 120886317861****, the maximum, minimum, and average values of the metric are 100, 93.1, and 99.52 at a 60-second interval.
Try it now
Test
RAM authorization
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 Metrics. |
acs_ecs_dashboard |
| MetricName |
string |
Yes |
The name of the metric. For more information about the metrics of cloud services, see Metrics. |
cpu_idle |
| Period |
string |
No |
The statistical period of the monitoring data. Valid values: 15, 60, 900, and 3600. Unit: seconds. Note
|
60 |
| StartTime |
string |
No |
The beginning of the time range to query. The following formats are supported:
Note
|
2019-01-30 00:00:00 |
| EndTime |
string |
No |
The end of the time range to query. The following formats are supported:
Note
The interval between StartTime and EndTime must be less than or equal to 31 days. |
2019-01-30 00:10:00 |
| Dimensions |
string |
No |
The dimensions that specify the resources to be monitored. Format: a collection of key-value pairs. For example: Note
You can query a maximum of 50 instances in a single request. |
[{"instanceId":"i-2ze2d6j5uhg20x47****"}] |
| NextToken |
string |
No |
The pagination cursor. Note
If you do not set this parameter, data is queried from the first page. If a value is returned for this parameter, it indicates that not all data is returned. You can use the value as the new token to start the next query and retrieve the next page of data. If no value is returned, it indicates that all data is returned. |
15761485350009dd70bb64cff1f0fff750b08ffff073be5fb1e785e2b020f1a949d5ea14aea7fed82f01dd8**** |
| Length |
string |
No |
The number of entries to return on each page for a paged query. Note
The maximum value of Length in a single request is 1440. |
1000 |
| Express |
string |
No |
The expression that is used for real-time computing based on the query results. Note
Only the groupby expression is supported. This expression is similar to the GROUP BY statement in databases. |
{"groupby":["userId","instanceId"]} |
For more information about common request parameters, see Common parameters.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| NextToken |
string |
The pagination cursor. |
15761441850009dd70bb64cff1f0fff6d0b08ffff073be5fb1e785e2b020f7fed9b5e137bd810a6d6cff5ae**** |
| RequestId |
string |
The request ID. |
3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42 |
| Success |
boolean |
Indicates whether the operation was successful. Valid values:
|
true |
| Datapoints |
string |
The list of monitoring data. |
[{"timestamp":1548777660000,"userId":"120886317861****","instanceId":"i-abc","Minimum":9.92,"Average":9.92,"Maximum":9.92}] |
| Code |
string |
The status code. Note
A value of 200 indicates that the call was successful. |
200 |
| Message |
string |
The error message. |
The specified resource is not found. |
| Period |
string |
The interval. Unit: seconds. Valid values: 60, 300, and 900. |
60 |
Examples
Success response
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 | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | %s | %s | |
| 404 | ResourceNotFound | The specified resource is not found. | The specified resource is not found. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.