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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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. Specify the value in the format of acs_Service name.

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
  • Set this parameter as needed.
  • For more information about the intervals for cloud services, see Appendix 1: Metrics.
StartTime String No 1618368900000

The beginning of the time range to query. The following formats are supported:

  • UNIX timestamp: the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.
  • Time format: YYYY-MM-DDThh:mm:ssZ.
Note
  • The specified time range includes the end time and excludes the start time. The start time must be earlier than the end time.
  • We recommend that you use UNIX timestamps to prevent time zone-related issues.
EndTime String No 1618368960000

The end of the time range to query. The following formats are supported:

  • UNIX timestamp: the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.
  • Time format: YYYY-MM-DDThh:mm:ssZ.
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 instanceId:i-2ze2d6j5uhg20x47****.

Note
  • Dimensions must be formatted as a JSON string in a specified order.
  • For more information about the dimensions for cloud services, see Appendix 1: Metrics.
NextToken String No IWBjqMYSy0is7zSMGu16****

The token that is used to initiate the next request if the response of the current request is truncated. You can use the token to initiate another request and obtain the remaining records.

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 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 HTTP status code 200 indicates that the request was successful.
Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
NextToken String IWBjqMYSy0is7zSMGu16****

The token that can be used to initiate the next request.

Period String 60

The 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 is not found.

For a list of error codes, visit the API Error Center.