Queries the monitoring data of a metric for a cloud service.
This topic describes how to query the monitoring data of the last 60 seconds for the cpu_idle metric of the acs_ecs_dashboard cloud service.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeMetricLast |
The operation that you want to perform. Set the value to DescribeMetricLast. |
MetricName | String | Yes | cpu_idle |
The name of the metric. For more information, see Metrics. |
Namespace | String | Yes | acs_ecs_dashboard |
The namespace of the cloud service. For more information, see Metrics. |
Period | String | No | 60 |
The interval at which monitoring data is collected. Unit: seconds. Valid values: 15, 60, 900, and 3600. Note If this parameter is not specified, monitoring data is queried at the interval at
which the metric data is reported.
|
StartTime | String | No | 2021-05-08 08:00:00 |
The start of the time range to query monitoring data.
Supported formats of the start time:
Note
|
EndTime | String | No | 2021-05-08 10:00:00 |
The end of the time range to query monitoring data.
Supported formats of the end time:
Note We recommend that you use UNIX timestamps to prevent time zone-related issues.
|
Dimensions | String | No | [{"instanceId":"i-abcdefgh12****"}] |
The dimensions. This parameter is used to specify the resources whose monitoring data is queried. This parameter includes a set of key-value pairs. Example: Note For more information, see Metrics.
|
NextToken | String | No | EB71D183-45BF-414D-AC36-42FCE094E561 |
The paging token.
|
Length | String | No | 1000 |
The number of entries to return on each page. Default value: 1000. |
Express | String | No | {"groupby":["userId","instanceId"]} |
The expression that is used to calculate the query results in real time. |
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | EB71D183-45BF-414D-AC36-42FCE094E561 |
The ID of the request. |
Code | String | 200 |
The HTTP status code. Note The HTTP status code 200 indicates that the request succeeds.
|
Success | Boolean | true |
Indicates whether the call succeeds. Valid values:
|
Period | String | 60 |
The interval at which monitoring data is queried. Unit: seconds. |
NextToken | String | 1620367920000457f80f8dbce544141470dd218c582c73813b72331323038383633313738363132393533242c692d327a65343233706d683933356f78743067726a32**** |
The paging token. |
Datapoints | String | [{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-0xii2bvf42iqvxbp****\",\"Average\":99.91,\"Minimum\":99.0,\"Maximum\":100.0},{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-2ze1qff61suafi71****\",\"Average\":98.89,\"Minimum\":97.03,\"Maximum\":100.0},{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-2ze423pmh935oxt0****\",\"Average\":89.3,\"Minimum\":74.11,\"Maximum\":97.98}] |
The list of monitoring data. |
Message | String | The specified resource is not found. |
The error message. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=DescribeMetricLast
&MetricName=CPUUtilization
&Namespace=acs_ecs_dashboard
&Period=60
&<Common request parameters>
Sample success responses
XML
format
<QueryMetricListResponse>
<RequestId>EB71D183-45BF-414D-AC36-42FCE094E561</RequestId>
<NextToken>1620367920000457f80f8dbce544141470dd218c582c73813b72331323038383633313738363132393533242c692d327a65343233706d683933356f78743067726a32****</NextToken>
<Period>60</Period>
<Datapoints>[{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-0xii2bvf42iqvxbp****\",\"Average\":99.91,\"Minimum\":99.0,\"Maximum\":100.0},{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-2ze1qff61suafi71****\",\"Average\":98.89,\"Minimum\":97.03,\"Maximum\":100.0},{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-2ze423pmh935oxt0****\",\"Average\":89.3,\"Minimum\":74.11,\"Maximum\":97.98}]</Datapoints>
<Code>200</Code>
<Success>true</Success>
</QueryMetricListResponse>
JSON
format
{
"RequestId": "EB71D183-45BF-414D-AC36-42FCE094E561",
"NextToken": "1620367920000457f80f8dbce544141470dd218c582c73813b72331323038383633313738363132393533242c692d327a65343233706d683933356f78743067726a32****",
"Period": "60",
"Datapoints": "[{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-0xii2bvf42iqvxbp****\",\"Average\":99.91,\"Minimum\":99.0,\"Maximum\":100.0},{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-2ze1qff61suafi71****\",\"Average\":98.89,\"Minimum\":97.03,\"Maximum\":100.0},{\"timestamp\":1620367920000,\"userId\":\"120886317861****\",\"instanceId\":\"i-2ze423pmh935oxt0****\",\"Average\":89.3,\"Minimum\":74.11,\"Maximum\":97.98}]",
"Code": "200",
"Success": true
}
Error codes
HttpCode | 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, visit the API Error Center.