All Products
Search
Document Center

Cloud Monitor:DescribeMetricLast

Last Updated:Jul 09, 2026

Queries the latest monitoring data of a specified metric.

Operation description

Limits

  • The DescribeMetricLast, DescribeMetricList, DescribeMetricData, and DescribeMetricTop operations share a free quota of 1,000,000 invocations per month in total. After the free quota is exhausted and you have not activated CloudMonitor Basic pay-as-you-go billing method, you cannot use this API operation normally. If you have activated CloudMonitor Basic pay-as-you-go billing method, this API operation remains available after the free quota is exhausted, and the excess usage is automatically billed. For more information about how to activate the pay-as-you-go billing method, see Activate pay-as-you-go billing.

  • A single API operation is limited to 50 invocations per second. This limit is shared by an Alibaba Cloud account and all Resource Access Management (RAM) users under the account.

Note

If the response contains Throttling.User or Request was denied due to user flow control when you invoke this API operation, the request is throttled. For the method to handle this issue, see How do I handle query API throttling.

Before you begin

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 following list describes the relationship:

  • 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 the maximum value is 100, the minimum value is 93.1, and the average value is 99.52 at 60-second intervals for instance i-abcdefgh12**** under account 123456789876****.

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 the namespaces of cloud services, see Cloud service monitoring.

acs_ecs_dashboard

MetricName

string

Yes

The metric name of the cloud service.

For information about metric names, see Cloud service monitoring.

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 specify a statistical period, the 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 Metrics page of the target cloud service in Cloud service monitoring.

60

StartTime

string

No

The start time of the query.

2019-01-31 10:00:00

EndTime

string

No

The end time of the query.

  • For second-level data, the actual start time of the query is the greater value between the time that is 20 minutes before EndTime and the specified startTime.

  • For minute-level data, the actual start time of the query is the greater value between the time that is 2 hours before EndTime and the specified startTime.

  • For hour-level data, the actual start time of the query is the greater value between the time that is 2 days before EndTime and the specified startTime.

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****"} and {"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 number of results that match the query conditions exceeds 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 the monitoring data. This parameter is used for paging.

Default value: 1000, which indicates 1,000 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: The operation was successful.

  • false: The operation 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.