All Products
Search
Document Center

CloudMonitor:DescribeMetricList

更新時間:Jul 26, 2024

Queries the monitoring data of a metric for a specified cloud service.

Operation description

Limits

Each API operation can be called up to 50 times per second. An Alibaba Cloud account and the RAM users within the account share the quota.

Note This topic provides an example to show 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 returned result indicates that the monitoring data for the instance i-abcdefgh12**** of the account 120886317861**** is queried at an interval of 60 seconds. The maximum, minimum, and average values of the metric are 100, 93.1, and 99.52.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cms:QueryMetricListget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NamespacestringYes

The namespace of the cloud service. Format: acs_service name.

For more information about the namespaces of cloud services, see Appendix 1: Metrics.

acs_ecs_dashboard
MetricNamestringYes

The name of the metric.

For more information about metric names, see Appendix 1: Metrics.

cpu_idle
PeriodstringNo

The interval at which the monitoring data is queried.

Valid values: 60, 300, and 900.

Unit: seconds.

Note Configure this parameter based on your business scenario.
60
StartTimestringNo

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

  • UNIX timestamp: the number of milliseconds that have elapsed since 00:00:00 Thursday, January 1, 1970
  • UTC time: the UTC time that follows the YYYY-MM-DDThh:mm:ssZ format
Note The specified period includes the end time and excludes the start time. The start time must be earlier than the end time.
2019-01-30 00:00:00
EndTimestringNo

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

  • UNIX timestamp: the number of milliseconds that have elapsed since 00:00:00 Thursday, January 1, 1970
  • UTC time: the UTC time that follows the YYYY-MM-DDThh:mm:ssZ format
2019-01-30 00:10:00
DimensionsstringNo

The dimensions that specify the resources whose monitoring data you want to query.

Set the value to a collection of key-value pairs. A typical key-value pair is instanceId:i-2ze2d6j5uhg20x47****.

Note You can query a maximum of 50 instances in a single request.
[{"instanceId": "i-abcdefgh12****"}]
NextTokenstringNo

The paging token.

Note If this parameter is not specified, the data on the first page is returned. A return value other than Null of this parameter indicates that not all entries have been returned. You can use this value as an input parameter to obtain entries on the next page. The value Null indicates that all query results have been returned.
15761485350009dd70bb64cff1f0fff750b08ffff073be5fb1e785e2b020f1a949d5ea14aea7fed82f01dd8****
LengthstringNo

The number of entries to return on each page.

Note The maximum value of the Length parameter in a request is 1440.
1000
ExpressstringNo

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.
{"groupby":["userId","instanceId"]}

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

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The paging token.

15761441850009dd70bb64cff1f0fff6d0b08ffff073be5fb1e785e2b020f7fed9b5e137bd810a6d6cff5ae****
RequestIdstring

The ID of the request.

3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42
Successboolean

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
true
Datapointsstring

The monitoring data.

[{"timestamp":1548777660000,"userId":"120886317861****","instanceId":"i-abc","Minimum":9.92,"Average":9.92,"Maximum":9.92}]
Codestring

The HTTP status code.

Note The status code 200 indicates that the call was successful.
200
Messagestring

The error message.

The specified resource is not found.
Periodstring

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

60

Examples

Sample success responses

JSONformat

{
  "NextToken": "15761441850009dd70bb64cff1f0fff6d0b08ffff073be5fb1e785e2b020f7fed9b5e137bd810a6d6cff5ae****",
  "RequestId": "3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42",
  "Success": true,
  "Datapoints": "[{\"timestamp\":1548777660000,\"userId\":\"120886317861****\",\"instanceId\":\"i-abc\",\"Minimum\":9.92,\"Average\":9.92,\"Maximum\":9.92}]",
  "Code": "200",
  "Message": "The specified resource is not found.",
  "Period": "60"
}

Error codes

HTTP status codeError codeError messageDescription
400%s%s-
404ResourceNotFoundThe specified resource is not found.The specified resource is not found.
500InternalErrorThe request processing has failed due to some unknown error.-
500InternalError%s-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-03-10The Error code has changedView Change Details