Help Center/ GaussDB/ API Reference/ APIs (Recommended)/ Metric Management/ Querying Metrics of All DB Instances
Updated on 2025-10-20 GMT+08:00

Querying Metrics of All DB Instances

Function

This API is used to query metrics of all DB instances. Before calling this API:

Debugging

You can debug this API in API Explorer.

URI

GET /v3/{project_id}/instances/metric-data

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are allowed.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition

Index offset. The query starts from the next piece of data indexed by this parameter. For example, if this parameter is set to 1 and limit is set to 10, only the 2nd to 11th records are displayed.

Constraints

N/A

Range

[0, 2^31-1]

Default Value

0: The query starts from the first data record.

limit

No

Integer

Definition

Number of records returned by a query. For example, if this parameter is set to 10, a maximum of 10 records can be displayed.

Constraints

N/A

Range

[1, 50]

Default Value

50

name

No

String

Definition

Instance name.

Instances of the same type can have same names under the same tenant.

Constraints

N/A

Range

The name can contain 4 to 64 characters and must start with a letter. Only letters (case-sensitive), digits, hyphens (-), and underscores (_) are allowed.

Default Value

N/A

instance_id

No

String

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

The value can contain 36 characters. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token.

You can obtain the token by calling the IAM API used to obtain a user token.

After the request is processed, the value of X-Subject-Token in the message header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Language.

Constraints

N/A

Range

  • zh-cn
  • en-us

Default Value

en-us

Response Parameters

Table 4 Response body parameters

Parameter

Type

Description

instances

Array of InstancesMetricResult objects

Definition

Instance information. For details, see Table 5.

total_count

Integer

Definition

Total number of records.

Range

N/A

Table 5 InstancesMetricResult field data structure description

Parameter

Type

Description

id

String

Definition

Instance ID.

Range

N/A

name

String

Definition

Instance name.

Range

N/A

status

String

Definition

Instance status.

Range

  • creating: An instance is being created.
  • normal: The instance is normal.
  • abnormal: The instance is abnormal.
  • createfail: The instance failed to be created.

mode

String

Definition

Instance type.

Range

N/A

engine_name

String

Definition

Engine name.

Range

N/A

engine_version

String

Definition

Engine version.

Range

N/A

solution

String

Definition

Deployment model.

Range

N/A

disk_used_size

String

Definition

Used instance disk size.

Range

N/A

disk_total_size

String

Definition

Total instance disk size.

Range

N/A

disk_usage

String

Definition

Instance disk usage.

Range

N/A

p80

String

Definition

Response time of 80% SQL statements.

Range

N/A

p95

String

Definition

Response time of 95% SQL statements.

Range

N/A

deadlocks

String

Definition

Deadlocks.

Range

N/A

buffer_hit_ratio

String

Definition

Buffer hit rate.

Range

N/A

nodes

Array of InstancesNodesResult objects

Definition

Instance node information. For details, see Table 6.

Table 6 InstancesNodesResult field data structure description

Parameter

Type

Description

id

String

Definition

Node ID.

Range

N/A

name

String

Definition

Node name.

Range

N/A

component_ids

Array of Strings

Definition

Component IDs.

Example Request

This API is used to query metrics of all DB instances. Before calling this API:

https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/metric-data?instance_id=e73893ef73754465a8bd2e0857bbf13ein14

Example Response

{ 
  "instances" : [ { 
    "id" : "ad8cd1440aa94a02ae4580fcbebb3143in14", 
    "name" : "user1-v3-independent", 
    "status" : "BUILD", 
    "mode" : "Centralized",
    "engine_name" : "GaussDB", 
    "engine_version" : "8.0.92", 
    "solution" : "1 primary + 2 standby",
    "disk_used_size" : 1.05, 
    "disk_total_size" : 160, 
    "disk_usage" : 0.62, 
    "p80" : 342, 
    "p95" : 501, 
    "deadlocks" : 0, 
    "buffer_hit_ratio" : 0, 
    "nodes" : [ { 
      "id" : "6b7616dfb1c14721b1a11dd5654c1515no14", 
      "name" : "DataNode1", 
      "component_ids" : [ "dn_6001", "dn_6002" ] 
    } ] 
  } ], 
  "total_count" : 100 
}

Status Codes

Error Codes

For details, see Error Codes.