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.
Usage notes
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
. 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
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. Format: acs_service name. For more information about the namespaces of cloud services, see Appendix 1: Metrics. |
MetricName | String | Yes | cpu_idle | The name of the metric. For more information about metric names, see Appendix 1: Metrics. |
Period | String | No | 60 | 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. |
StartTime | String | No | 2019-01-30 00:00:00 | 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. |
EndTime | String | No | 2019-01-30 00:10:00 | The end of the time range to query. The following formats are supported:
|
Dimensions | String | No | [{"instanceId": "i-abcdefgh12****"}] | 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. |
NextToken | String | No | 15761485350009dd70bb64cff1f0fff750b08ffff073be5fb1e785e2b020f1a949d5ea14aea7fed82f01dd8**** | 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. |
Length | String | No | 1000 | The number of entries to return on each 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 paging token. |
RequestId | String | 3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42 | The ID of the request. |
Success | Boolean | true | Indicates whether the call 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 HTTP status code. Note The status code 200 indicates that the call was successful. |
Message | String | The specified resource is not found. | The error message. |
Period | String | 60 | The interval at which the monitoring data is queried. 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 error message returned because the specified resource is not found. |
For a list of error codes, see Service error codes.