Queries the monitoring data sorted by a specified field on a time series metric of a cloud service in a specified period.

For more information about how to assign values to the Namespace, Project, Metric, Period, and Dimensions parameters for cloud services, see DescribeMetricMetaList or Appendix 1: Metrics.

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 DescribeMetricTop

The operation that you want to perform. Set the value to DescribeMetricTop.

MetricName String Yes cpu_idle

The name of the metric.

Namespace String Yes acs_ecs_dashboard

The namespace of the service.

Specify the value in the format of acs_Service name.

Orderby String Yes Average

The field based on which the monitoring data is sorted.

Period String No 60

The time interval at which monitoring data is queried. Unit: seconds. Valid values: 60, 300, and 900.

Set this parameter as needed. Examples:

  • If you set this parameter to 60 and 1,440 monitoring data entries exist, only the first 1,000 entries are returned.
  • If you set this parameter to 300 and 288 monitoring data entries exist, all of the entries are returned.
Note The maximum number of returned monitoring data entries is 1,000. If the number exceeds 1,000, only the first 1,000 entries are returned.
StartTime String No 2019-01-30 00:00:00

The beginning of the time range for the query. Supported formats:

  • UNIX timestamp: the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.
  • Time format: YYYY-MM-DDThh:mm:ssZ.
Note The period specified by StartTime and EndTime includes the time point specified by EndTime but does not include the time point specified by StartTime. StartTime must be earlier than EndTime.
EndTime String No 2019-01-30 00:10:00

The end of the time range for the query. Supported formats:

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

The key and value must be 1 to 64 bytes in length, respectively. Excessive bytes are truncated from the string.

The key and value can contain letters, digits, periods (.), hyphens (-), underscores (_), forward slashes (/), and backslashes (\).

Note Dimensions must be organized in a JSON string and follow the required order.
OrderDesc String No False

The method that is used to sort the monitoring data. Valid values:

  • True: sorts values in ascending order.
  • False: sorts values in descending order.
Length String No 1000

The number of entries to return on each page. Default value: 1000.

Express String No {"groupby":["userId","instanceId"]}

The expression for real-time computation on the query results.

Only the groupby expression is supported, which is similar to the GROUP BY statement used in databases.

Response parameters

Parameter Type Example Description
RequestId String 3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42

The ID of the request.

Code String 200

The HTTP status code.

Note The status code 200 indicates that the call was successful.
Datapoints String [{"timestamp":1548777660000,"userId":"123","instanceId":"i-abc","Minimum":9.92,"Average":9.92,"Maximum":9.92,"_count":1}]

The obtained monitoring data of the metric.

Period String 60

The time interval at which monitoring data was queried. Unit: seconds. Valid values: 60, 300, and 900.

Message String The Request is not authorization.

The returned message.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeMetricTop
&MetricName=cpu_idle
&Namespace=acs_ecs_dashboard
&Orderby=Average
&<Common request parameters>

Sample success responses

XML format

<Period>60</Period>
<Datapoints>
    <order>1</order>
    <timestamp>1551687360000</timestamp>
    <userId>12345****</userId>
    <instanceId>i-2zeehst1****</instanceId>
    <Maximum>16.41</Maximum>
    <Minimum>4.66</Minimum>
    <Average>7.74</Average>
    <_count>1</_count>
</Datapoints>
<Datapoints>
    <order>2</order>
    <timestamp>1551687360000</timestamp>
    <userId>12345****</userId>
    <instanceId>i-2zefxdy2****</instanceId>
    <Maximum>15.74</Maximum>
    <Minimum>5.03</Minimum>
    <Average>7.14</Average>
    <_count>1</_count>
</Datapoints>
<RequestId>1F68A4E8-4488-48E7-9189-3E1F5165E64E</RequestId>
<Code>200</Code>

JSON format

{
    "Period": "60",
    "Datapoints": [
        {
            "order": 1,
            "timestamp": 1551687360000,
            "userId": "12345****",
            "instanceId": "i-2zeehst1****",
            "Maximum": 16.41,
            "Minimum": 4.66,
            "Average": 7.74,
            "_count": 1
        },
        {
            "order": 2,
            "timestamp": 1551687360000,
            "userId": "12345****",
            "instanceId": "i-2zefxdy2****",
            "Maximum": 15.74,
            "Minimum": 5.03,
            "Average": 7.14,
            "_count": 1
        }
    ],
    "RequestId": "1F68A4E8-4488-48E7-9189-3E1F5165E64E",
    "Code": "200"
}

Error codes

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