Help Center/ Workspace/ API Reference/ Workspace Application Streaming APIs/ Server Management/ Querying the Monitoring Data of a Metric of a Specified Granularity in a Specified Time Range
Updated on 2026-05-21 GMT+08:00

Querying the Monitoring Data of a Metric of a Specified Granularity in a Specified Time Range

Function

Queries the monitoring data of a metric of a specified granularity in a specified time range.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

URI

GET /v1/{project_id}/app-servers/server-metric-data/{server_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Unique ID of a project

server_id

Yes

String

Unique ID of a server.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

namespace

Yes

String

Service namespace, for example, SYS.ECS/AGT.ECS. If the namespace is AGT.ECS, GPU monitoring metrics will be queried. - SYS.ECS: basic monitoring metrics of ECS - AGT.ECS: OS monitoring metrics (GPU metrics) of ECS

metric_name

Yes

String

Monitoring metric names: - Metric names of the SYS.ECS namespace. For details, see Basic ECS Metrics. - Metric names of the AGT.ECS namespace. For details, see OS Metric: GPU.

from

Yes

String

Start time of the query. The time is a UNIX timestamp and the unit is ms.

to

Yes

String

End time of the query. The time is a UNIX timestamp and the unit is ms. The value of from must be earlier than that of to.

period

Yes

Integer

Monitoring data granularity. Options: - 1: real-time data - 300: 5-minute granularity - 1200: 20-minute granularity - 3600: 1-hour granularity - 14400: 4-hour granularity - 86400: 1-day granularity

filter

Yes

String

Data aggregation mode. The following aggregation modes are supported: - average: average value of metric data in an aggregation period; - max: maximum value of metric data in an aggregation period; - min: minimum value of metric data in an aggregation period; - sum: sum of metric data in an aggregation period; - variance: variance of metric data in an aggregation period

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

server_metrics

Array of ServerMetricData objects

Monitoring data.

Table 5 ServerMetricData

Parameter

Type

Description

metric_name

String

Metric name.

datapoints

Array of ServerDataPoints objects

Metric data list.

dimension_value

String

Dimension value. This parameter is specified only when GPU monitoring information is queried.

Table 6 ServerDataPoints

Parameter

Type

Description

average

Double

Average value of metric data within a rollup period.

max

Double

Maximum value of metric data within a rollup period.

min

Double

Minimum value of metric data within a rollup period.

sum

Double

Sum of metric data within a rollup period.

variance

Double

Variance of metric data within a rollup period.

timestamp

Long

Time when the metric is collected. It is a UNIX timestamp in millisecond.

unit

String

Metric unit.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 405

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 503

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Example Requests

GET /v1/a4da8115c9d8464ead3a38309130523f/app-servers/server-metric-data/8115c9d8464ead3a38309130?namespace=AGT.ECS&metric_name=cpu_util&from=1691671739879&to=1691671739872&period=1&filter=average

Example Responses

Status code: 200

Successful.

{
  "server_metrics" : [ {
    "datapoints" : [ {
      "average" : 0.23,
      "timestamp" : 1442341200000,
      "unit" : "%"
    } ],
    "metric_name" : "gpu_usage_encoder",
    "dimension_value" : "2e84018fc8b4484b94e89aae212fe615"
  }, {
    "datapoints" : [ {
      "average" : 0.23,
      "timestamp" : 1442341200000,
      "unit" : "%"
    } ],
    "metric_name" : "gpu_usage_encoder",
    "dimension_value" : "7784018fc8b4484b94e89aae212fe455"
  } ]
}

Status Codes

Status Code

Description

200

Successful.

400

The request cannot be understood by the server due to malformed syntax.

401

Authentication failed.

403

Permissions required.

404

No resources found.

405

The request method is not allowed.

500

An internal service error occurred. For details, see the error code description.

503

Service unavailable.

Error Codes

See Error Codes.