Queries the monitoring data of a metric for a specified cloud service.
This topic provides an example of 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 response indicates the monitoring data of the i-2ze5xhf87nzvhcxr****
instance that belongs to the 100931896542****
Alibaba Cloud account. At a statistical period of 60 seconds, the maximum value is
100, the minimum value is 95.47, and the average value is 98.35.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeMetricList |
The operation that you want to perform. Set the value to DescribeMetricList. |
MetricName | String | Yes | cpu_idle |
The name of the metric. Note For more information about metric names, see Appendix 1: Metrics.
|
Namespace | String | Yes | acs_ecs_dashboard |
The namespace of the cloud service. Note For more information about the namespaces of cloud services, see Appendix 1: Metrics.
|
Period | String | No | 60 |
The interval at which the monitoring data is queried. Unit: seconds. Valid values: 60, 300, and 900. Note
|
StartTime | String | No | 1618368900000 |
The beginning of the time range to query. The following formats are supported:
Note
|
EndTime | String | No | 1618368960000 |
The end of the time range to query. The following formats are supported:
Note We recommend that you use UNIX timestamps to prevent time zone-related issues.
|
Dimensions | String | No | [{"instanceId": "i-abcdefgh12****"}] |
The dimensions that specify the resources for which you want to query monitoring data. Set the value to a collection of key-value pairs. A typical key-value pair is Note
|
NextToken | String | No | IWBjqMYSy0is7zSMGu16**** |
The token that is used to initiate the next request. If the response of the current request is truncated, this token is used to initiate another request and obtain the remaining entries. |
Length | String | No | 1000 |
The number of entries to return on each page. Valid values: 1 to 1440. |
Express | String | No | null |
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 |
---|---|---|---|
RequestId | String | E68C1F4B-0CBC-4A0B-BCB5-212431FB817E |
The ID of the request. |
Code | String | 200 |
The HTTP status code. Note The value 200 indicates that the call was successful.
|
Success | Boolean | true |
Indicates whether the call was successful. Valid values:
|
NextToken | String | IWBjqMYSy0is7zSMGu16**** |
The token that is used to initiate the next request. |
Period | String | 60 |
The time interval at which the monitoring data was queried. Unit: seconds. Valid values: 60, 300, and 900. |
Datapoints | String | [{\"timestamp\":1625328060000,\"userId\":\"100931896542****\",\"instanceId\":\"i-2ze5xhf87nzvhcxr****\",\"Average\":98.35,\"Minimum\":95.47,\"Maximum\":100.0},{\"timestamp\":1625328060000,\"userId\":\"100931896542****\",\"instanceId\":\"i-bp1ayw2n047u2wkl****\",\"Average\":96.49,\"Minimum\":50.0,\"Maximum\":100.0}] |
The monitoring data. |
Message | String | The specified resource is not found. |
The error message. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=DescribeMetricList
&MetricName=cpu_idle
&Namespace=acs_ecs_dashboard
&<Common request parameters>
Sample success responses
XML
format
<DescribeMetricListResponse>
<RequestId>E68C1F4B-0CBC-4A0B-BCB5-212431FB817E</RequestId>
<Period>60</Period>
<Datapoints>[{\"timestamp\":1625328060000,\"userId\":\"100931896542****\",\"instanceId\":\"i-2ze5xhf87nzvhcxr****\",\"Average\":98.35,\"Minimum\":95.47,\"Maximum\":100.0},{\"timestamp\":1625328060000,\"userId\":\"100931896542****\",\"instanceId\":\"i-bp1ayw2n047u2wkl****\",\"Average\":96.49,\"Minimum\":50.0,\"Maximum\":100.0}]</Datapoints>
<Code>200</Code>
<Success>true</Success>
</DescribeMetricListResponse>
JSON
format
{
"RequestId": "E68C1F4B-0CBC-4A0B-BCB5-212431FB817E",
"Period": "60",
"Datapoints": "[{\"timestamp\":1625328060000,\"userId\":\"100931896542****\",\"instanceId\":\"i-2ze5xhf87nzvhcxr****\",\"Average\":98.35,\"Minimum\":95.47,\"Maximum\":100.0},{\"timestamp\":1625328060000,\"userId\":\"100931896542****\",\"instanceId\":\"i-bp1ayw2n047u2wkl****\",\"Average\":96.49,\"Minimum\":50.0,\"Maximum\":100.0}]",
"Code": "200",
"Success": true
}
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 does not exist. |
For a list of error codes, visit the API Error Center.