Queries the monitoring data of a metric for a specified cloud service.
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.
Precautions
The storage duration of the monitoring data of each cloud service is related to the Period
parameter (statistical period). A larger value of the Period
parameter indicates that the queried monitoring data is distributed in a larger time range and the storage duration of the monitoring data is longer. The following list describes the specific relationships:
- If the value of the
Period
parameter is less than 60 seconds, the storage duration is seven days. - If the value of the
Period
parameter is 60 seconds, the storage duration is 31 days. - If the value of the
Period
parameter is 300 seconds, the storage duration is 91 days.
Usage notes
This topic provides an example on how to query the monitoring data of the 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, respectively.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeMetricList | The operation that you want to perform. Set the value to DescribeMetricList. |
Namespace | String | Yes | acs_ecs_dashboard | The namespace of the cloud service. For more information about the namespaces of cloud services, see Appendix 1: Metrics. |
MetricName | String | Yes | cpu_idle | The metric that is used to monitor the cloud service. For more information about metric names, see Appendix 1: Metrics. |
Period | String | No | 60 | The statistical period of the monitoring data. Valid values: 15, 60, 900, and 3600. Unit: seconds. Note
|
StartTime | String | No | 2019-01-30 00:00:00 | The start of the time range to query. The following formats are supported:
Note
|
EndTime | String | No | 2019-01-30 00:10:00 | The end of the time range to query. The following formats are supported:
Note The interval between the start time and the end time is less than or equal to 31 days. |
Dimensions | String | No | [{"instanceId":"i-2ze2d6j5uhg20x47****"}] | The monitoring dimensions of the specified resource. Set the value to a collection of Note You can query a maximum of 50 instances in a single request. |
NextToken | String | No | 15761485350009dd70bb64cff1f0fff750b08ffff073be5fb1e785e2b020f1a949d5ea14aea7fed82f01dd8**** | The pagination 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. |
Length | String | No | 1000 | The number of entries per page. Note The maximum value of the Length parameter in a request is 1440. |
Express | String | No | {"groupby":["userId","instanceId"]} | 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. |
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
NextToken | String | 15761441850009dd70bb64cff1f0fff6d0b08ffff073be5fb1e785e2b020f7fed9b5e137bd810a6d6cff5ae**** | The pagination token. |
RequestId | String | 3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42 | The request ID. |
Success | Boolean | true | Indicates whether the request was successful. Valid values:
|
Datapoints | String | [{"timestamp":1548777660000,"userId":"120886317861****","instanceId":"i-abc","Minimum":9.92,"Average":9.92,"Maximum":9.92}] | The monitoring data. |
Code | String | 200 | The status code. Note The status code 200 indicates that the request was successful. |
Message | String | The specified resource is not found. | The error message. |
Period | String | 60 | The time interval. Unit: seconds. Valid values: 60, 300, and 900. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=DescribeMetricList
&MetricName=cpu_idle
&Namespace=acs_ecs_dashboard
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeMetricListResponse>
<Period>60</Period>
<Datapoints>
<timestamp>1490152860000</timestamp>
<Maximum>100</Maximum>
<userId>120886317861****</userId>
<Minimum>93.1</Minimum>
<instanceId>i-abcdefgh12****</instanceId>
<Average>99.52</Average>
</Datapoints>
<RequestId>6A5F022D-AC7C-460E-94AE-B9E75083D027</RequestId>
<Success>true</Success>
<Code>200</Code>
</DescribeMetricListResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Period" : "60",
"Datapoints" : [ {
"timestamp" : 1490152860000,
"Maximum" : 100,
"userId" : "120886317861****",
"Minimum" : 93.1,
"instanceId" : "i-abcdefgh12****",
"Average" : 99.52
} ],
"RequestId" : "6A5F022D-AC7C-460E-94AE-B9E75083D027",
"Success" : true,
"Code" : "200"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
404 | ResourceNotFound | The specified resource is not found. | The specified resource is not found. |
For a list of error codes, see Service error codes.