Querying Metrics of a Specific DB Instance
Function
This API is used to query metrics of a specified DB instance. Before calling this API:
- Learn how to authenticate this API.
- Obtain the required region and endpoint.
Debugging
You can debug this API in API Explorer.
URI
GET /v3/{project_id}/instances/{instance_id}/metric-data
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
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 |
instance_id |
Yes |
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
start_time |
Yes |
String |
Definition Start time in timestamp format, for example, 1756971683303. Constraints N/A Range N/A Default Value N/A |
end_time |
Yes |
String |
Definition End time in timestamp format, for example, 1756975283303. Constraints N/A Range N/A Default Value N/A |
metric |
Yes |
Array |
Definition Metric ID, which can be obtained by calling the "Querying Metrics of a Metric Group" API. For example, to query the CPU usage, set this parameter value to rds001_cpu_util. Constraints N/A |
node_id |
Yes |
Array |
Definition Node ID. Constraints N/A |
component_id |
No |
Array |
Definition Component ID, for example, dn_6001. Constraints N/A |
Request 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
Default Value en-us |
Response Parameters
Parameter |
Type |
Description |
---|---|---|
instance_id |
String |
Definition Instance ID. Range The value can contain 36 characters. Only letters and digits are allowed. |
metrics |
Array of MetricDataResult objects |
Definition Metric data set. For details, see Table 5. |
Parameter |
Type |
Description |
---|---|---|
metric |
String |
Definition Metric ID. Range N/A |
type |
String |
Definition Metric type. Range
|
unit |
String |
Definition Metric unit. Range N/A |
datapoints |
Array of DatapointResult objects |
Definition Metric dimension and value. For details, see Table 6. |
timestamps |
Array of Strings |
Definition Timestamp. |
Example Request
https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/e73893ef73754465a8bd2e0857bbf13ein14/metric-data?start_time=1699260798398&end_time=1699319598743&metric=rds001_cpu_util,rds002_mem_util&node_id=6b7616dfb1c14721b1a11dd5654c1515no14,ef3af6ce4d064eb28d38eff00ff96dfano14&component_id=dn_6001,dn_6002
Example Response
{ "instance_id" : "f7fb5cda6f134275830e4e3af80788aein14", "metrics" : [ { "metric" : "rds036_deadlocks", "type" : "INSTANCE", "unit" : "Count", "datapoints" : [ { "datapoint_name" : "f7fb5cda6f134275830e4e3af80788aein14", "datapoint_values" : [ 0, 1 ] } ], "timestamps" : [ 1699495140000, 1699495200000 ] }, { "metric" : "rds001_cpu_util", "type" : "NODE", "unit" : "%", "datapoints" : [ { "datapoint_name" : "node_01", "datapoint_values" : [ 24.29, 37.81 ] }, { "datapoint_name" : "node_02", "datapoint_values" : [ 18.8, 17.69 ] } ], "timestamps" : [ 1699495140000, 1699495200000 ] }, { "metric" : "rds008_disk_used_size", "type" : "COMPONENT", "unit" : "GB", "datapoints" : [ { "datapoint_name" : "dn_6001", "datapoint_values" : [ 1.61, 1.62 ] }, { "datapoint_name" : "dn_6002", "datapoint_values" : [ 1.64, 1.66 ] } ], "timestamps" : [ 1699495140000, 1699495200000 ] } ] }
Status Codes
- Normal
- Abnormal
For details, see Status Codes.
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot