Querying Monitoring Data
Function
This API is used to query monitoring data of metrics within a specified period. You can specify a dimension or period to query. (This API will not evolve. You are advised to use Querying Expression Calculation Results in a Specified Period Using the POST Method.)
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/ams/metricdata
Parameter | Mandatory | Type | Description |
|---|---|---|---|
project_id | Yes | String | Project ID, which can be obtained from the console or by calling an API. For details, see Obtaining a Project ID. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
fillValue | No | String | Value filled for breakpoints in monitoring data. Default value: –1.
Enumeration values:
|
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Auth-Token | Yes | String | User token obtained from IAM. For details, see Obtaining a Token. |
Content-Type | Yes | String | Message body type or format. Content type, which is application/json. Enumeration values:
|
Parameter | Mandatory | Type | Description |
|---|---|---|---|
metrics | Yes | Array of MetricQueryMetricParam objects | Metric list. A JSON array can contain up to 20 objects. |
period | Yes | Integer | Monitoring data granularity. Options:
|
statistics | Yes | Array of strings | Statistic. Values: maximum, minimum, sum, average, and sampleCount. |
timerange | Yes | String | Time range specified to query data of the last N minutes when the client time is inconsistent with the server time. It can also be used to accurately query the data of a specified period. Example:
Format: startTimeInMillis.endTimeInMillis.durationInMinutes Parameter description:
Constraint: In a single request, the following condition must be met: durationInMinutes × 60/period ≤ 1,440 |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
dimensions | Yes | Array of Dimension objects | List of time series dimensions. To query the time series dimension list, call the API Querying Time Series Objects. Neither the array nor the name/value of any dimension in the array can be left blank. |
metricName | Yes | String | Metric name. Length: 1 to 255 characters. Options: basic metrics (such as cpuUsage and cpuCoreUsed) provided by AOM, and custom metrics. To query metrics, call the API Querying Tag Values. |
namespace | Yes | String | Metric namespace. Options:
Custom namespaces are also supported. To query namespaces, call the API Querying Tag Values. |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
errorCode | String | Response code. |
errorMessage | String | Response message. |
metrics | Array of MetricDataValue objects | Metric list. |
Parameter | Type | Description |
|---|---|---|
dataPoints | Array of MetricDataPoints objects | Key metric. |
metric | MetricQueryMetricParam object | Query parameters. |
Parameter | Type | Description |
|---|---|---|
statistics | Array of StatisticValue objects | Statistic. |
timestamp | Long | Timestamp. |
unit | String | Time series unit. |
Parameter | Type | Description |
|---|---|---|
statistic | String | Statistic. |
value | Double | Statistical result. |
Parameter | Type | Description |
|---|---|---|
dimensions | Array of Dimension objects | List of time series dimensions. To query the time series dimension list, call the API Querying Time Series Objects. Neither the array nor the name/value of any dimension in the array can be left blank. |
metricName | String | Metric name. Length: 1 to 255 characters. Options: basic metrics (such as cpuUsage and cpuCoreUsed) provided by AOM, and custom metrics. To query metrics, call the API Querying Tag Values. |
namespace | String | Metric namespace. Options:
Custom namespaces are also supported. To query namespaces, call the API Querying Tag Values. |
Example Requests
Query the monitoring data of cpuUsage in the PAAS.CONTAINER namespace in the last five minutes.
https://{Endpoint}/v1/{project_id}/ams/metricdata
{
"metrics" : [ {
"dimensions" : [ {
"name" : "appName",
"value" : "aomApp"
} ],
"metricName" : "cpuUsage",
"namespace" : "PAAS.CONTAINER"
} ],
"period" : 60,
"statistics" : [ "maximum", "minimum", "sum" ],
"timerange" : "-1.-1.5"
} Example Responses
Status code: 200
OK: The request is successful.
{
"errorCode" : "SVCSTG_AMS_2000000",
"errorMessage" : "success",
"metrics" : [ {
"metric" : {
"namespace" : "PAAS.CONTAINER",
"metricName" : "cpuUsage",
"dimensions" : [ {
"name" : "appName",
"value" : "aomApp"
} ]
},
"dataPoints" : [ {
"timestamp" : "1467892800000",
"unit" : "Percent",
"statistics" : [ {
"statistic" : "maximum",
"value" : "23"
} ]
} ]
} ]
} Status Codes
Status Code | Description |
|---|---|
200 | OK: The request is successful. |
400 | Bad Request: The request is invalid. The client should not repeat the request without modifications. |
401 | Unauthorized: The authentication information is incorrect or invalid. |
403 | Forbidden: The request is rejected. The server has received the request and understood it, but the server refuses to respond to it. The client should not repeat the request without modifications. |
500 | Internal Server Error: The server is able to receive the request but unable to understand the request. |
503 | Service Unavailable: The requested service is invalid. The client should not repeat the request without modifications. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.

