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
|
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
|
Parameter |
Type |
Description |
|---|---|---|
|
apiVersion |
String |
Definition: Resource version. Range:
|
|
kind |
String |
Definition: Resource type. Range:
|
|
items |
Array of MetricsItem objects |
Definition: Metric list. |
|
Parameter |
Type |
Description |
|---|---|---|
|
table |
Object |
Definition: Resource list. |
|
metadata |
ResourceMetricsMetadata object |
Definition: Resource metric metadata. |
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.
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