All Products
Search
Document Center

Cloud Monitor:DescribeMetricLast

Last Updated:Jul 21, 2026

Queries the latest monitoring data of a specified metric.

Operation description

Before you begin

  • Invocations of DescribeMetricLast, DescribeMetricList, DescribeMetricData, and DescribeMetricTop share a combined free quota of 1,000,000 calls per month. After the free quota is exhausted, if you have not activated CloudMonitor Basic pay-as-you-go billing method, you cannot use this API normally. If you have activated CloudMonitor Basic pay-as-you-go billing method, the API continues to work after the free quota is exhausted, and usage beyond the free quota is automatically billed. For the method to activate pay-as-you-go billing, see Activate pay-as-you-go billing.

  • The rate limit for a single API operation is 50 calls per second. This limit is shared by an Alibaba Cloud account and all Resource Access Management (RAM) users under the account.

Note

When you invoke an API operation, if the response contains Throttling.User or Request was denied due to user flow control, the API is being throttled. For the handling method, see How do I handle query API throttling.

Notes

The storage duration of cloud service monitoring data depends on the Period (statistical period). A larger Period value results in sparser monitoring data and a longer storage duration. The relationships are as follows:

  • If Period is less than 60 seconds, the storage duration is 7 days.

  • If Period is equal to 60 seconds, the storage duration is 31 days.

  • If Period is greater than or equal to 300 seconds, the storage duration is 91 days.

Operation description

This topic provides an example of how to query the latest monitoring data of the CPUUtilization metric for the cloud service acs_ecs_dashboard. The response shows that for instance i-abcdefgh12**** under account 123456789876****, the maximum value is 100, the minimum value is 93.1, and the average value is 99.52 at a 60-second interval.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cms:QueryMetricLast

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Namespace

string

Yes

The namespace of the cloud service.

For information about namespaces of cloud services, see Cloud service monitoring metrics.

acs_ecs_dashboard

MetricName

string

Yes

The metric name of the cloud service.

For information about metric names, see Cloud service monitoring metrics.

CPUUtilization

Period

string

No

The statistical period of the monitoring data.

Valid values: 15, 60, 900, and 3600.

Unit: seconds.

Note
  • If you do not set the statistical period, monitoring data is queried based on the reporting period that was specified when the metric was registered. - The statistical period varies by metric (MetricName) for each cloud service. For more information, see the Min Periods column on the metric list page of the target cloud service in Cloud service monitoring metrics.

60

StartTime

string

No

The start time.

Two formats are supported: 1. A UNIX timestamp string in milliseconds (ms), which represents the number of milliseconds elapsed since 1970-01-01 00:00:00 UTC. 2. A time string in the ISO 8601 format of YYYY-MM-DDThh:mm:ssZ in UTC.

Note

The query range uses a left-exclusive and right-inclusive mode. StartTime cannot be equal to or greater than EndTime, and the interval between them must be less than or equal to 31 days.

2019-01-31 10:00:00

EndTime

string

No

The end time for querying the metric.

The system automatically limits the query start time (query window size) based on data granularity:

  1. Second-level data: The maximum query span is 20 minutes (start time = Max(startTime, EndTime - 20min)).

  2. Minute-level data: The maximum query span is 2 hours (start time = Max(startTime, EndTime - 2h)).

  3. Hour-level data: The maximum query span is 2 days (start time = Max(startTime, EndTime - 2d)).

Note

If the specified startTime is earlier than the limit, the system automatically uses the limit as the actual query start time.

2019-01-31 10:10:00

Dimensions

string

No

The monitoring dimensions of the specified resource.

Format: a collection of key:value pairs. Example: {"userId":"120886317861****"} or {"instanceId":"i-2ze2d6j5uhg20x47****"}.

Note

A maximum of 50 instances can be queried in a single request.

[{"instanceId":"i-2ze2d6j5uhg20x47****"}]

NextToken

string

No

The pagination cursor.

  • If the query results that match the filter conditions exceed the page size, a pagination cursor is returned.

  • To retrieve the next page of data, use the returned cursor value as the request parameter until no cursor value is returned, which indicates that all data has been retrieved.

15761432850009dd70bb64cff1f0fff6c0b08ffff073be5fb1e785e2b020f7fed9b5e137bd810a6d6cff5ae****

Length

string

No

The number of entries per page for monitoring data. This parameter is used for paged query.

Default value: 1000, which indicates 1000 entries of monitoring data per page.

Note

The maximum value of Length in a single request is 1440.

1000

Express

string

No

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

{"groupby":["userId","instanceId"]}

For more information about common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

NextToken

string

The pagination cursor.

xxxxxx

RequestId

string

The request ID.

021472A6-25E3-4094-8D00-BA4B6A5486C3

Success

boolean

Indicates whether the operation was successful. Valid values:

  • true: Successful.

  • false: Failed.

true

Datapoints

string

The monitoring data list.

[{"timestamp":1548777660000,"userId":"123456789876****","instanceId":"i-abcdefgh12****","Minimum":93.1,"Average":99.52,"Maximum":100}]

Code

string

The status code.

Note

A value of 200 indicates success.

200

Message

string

The error message.

The specified resource is not found.

Period

string

The time interval.

Unit: seconds.

60

Examples

Success response

JSON format

{
  "NextToken": "xxxxxx",
  "RequestId": "021472A6-25E3-4094-8D00-BA4B6A5486C3",
  "Success": true,
  "Datapoints": "[{\"timestamp\":1548777660000,\"userId\":\"123456789876****\",\"instanceId\":\"i-abcdefgh12****\",\"Minimum\":93.1,\"Average\":99.52,\"Maximum\":100}]",
  "Code": "200",
  "Message": "The specified resource is not found.",
  "Period": "60"
}

Error codes

HTTP status code

Error code

Error message

Description

400 ParameterInvalid Illegal parameters.
500 InternalError The request processing has failed due to some unknown error.
403 AccessForbidden User not authorized to operate on the specified resource.
404 ResourceNotFound The specified resource is not found. The specified resource is not found.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.