Help Center/ ModelArts/ API Reference/ Resource Management/ Querying the Real-Time Resource Usage
Updated on 2025-11-19 GMT+08:00

Querying the Real-Time Resource Usage

Function

This API is used to obtain the real-time usage of all resource pools in the current project. This API is used when you need to query the real-time usage of resource pools when monitoring resource usage, optimizing resources, planning capacity, or troubleshooting faults. The resource usage includes the usage of CPU, memory, and storage resources. Before using this API, ensure that you have the required permission and there is a running resource pool. After the query, the API returns the real-time usage data of the resource pool, including the usage percentage, resource type, and timestamp. If you do not have the required permission, the resource pool does not exist, or the system cannot obtain the real-time data, the API will return an error message.

Debugging

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

URI

GET /v2/{project_id}/metrics/runtime/pools

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: User project ID. For details, see Obtaining a Project ID and Name.

Constraints: N/A

Range: N/A

Default Value: N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

apiVersion

String

Definition: Resource version.

Range:

  • os.modelarts.xxxxx/v2

kind

String

Definition: Resource type.

Range:

  • PoolMetricsList

items

Array of MetricsItem objects

Definition: Metric list.

Table 3 MetricsItem

Parameter

Type

Description

table

Object

Definition: Resource list.

metadata

ResourceMetricsMetadata object

Definition: Resource metric metadata.

Table 4 ResourceMetricsMetadata

Parameter

Type

Description

name

String

Definition: Name of a resource metric.

Range: N/A

labels

Object

Definition: Tags of a resource metric.

Example Requests

GET https://{endpoint}/v2/{project_id}/metrics/runtime/pools

Example Responses

Status code: 200

OK.

{
  "apiVersion" : "v2",
  "kind" : "PoolMetricsList",
  "items" : [ {
    "table" : {
      "allocated" : {
        "value" : {
          "cpu" : 5,
          "memory" : "15548Mi",
          "tnt004" : "1073m"
        },
        "timestamp" : "2022-03-30T07:09:10Z",
        "window" : "1m"
      },
      "capacity" : {
        "value" : {
          "cpu" : 16,
          "memory" : "64Gi",
          "tnt004" : 2
        },
        "maxValue" : {
          "cpu" : 16,
          "memory" : "64Gi",
          "tnt004" : 2
        },
        "timestamp" : "2022-03-30T07:09:10Z",
        "window" : "1m"
      }
    },
    "metadata" : {
      "name" : "hougang-rse-pool"
    }
  } ]
}

Status Codes

Status Code

Description

200

OK.

Error Codes

See Error Codes.