Retrieve Virtual Machine Performance Metrics
Access comprehensive performance analytics for a specific virtual machine instance, including CPU utilization, memory allocation, network throughput, and storage metrics. Data retrieval periods can be customized through optional duration parameters.
HTTP Request
GET
{API_URL}virtual-machines/{id}/metrics
Path Parameters
Parameter | Requirement | Type | Description |
---|---|---|---|
id | Required | string | Target instance's unique identifier |
duration | Optional | string | Time window for metrics retrieval. Options: 1h , 2h , 4h , 6h , 12h , 1d , 3d , 7d , 15d , 30d (Default: all) |
Response Structure
status boolean
Operation result indicator. Returns true
for successful execution, false
when encountering an error.
message string
Descriptive response indicating the outcome of the metrics retrieval request.
data object
Comprehensive performance metrics collection including:
Metric Categories
cpu
: Processing unit utilization metricsmemory
: RAM utilization statisticsnetwork
: Input/Output bandwidth measurementsdisk
: Storage read/write operations data
Implementation Example
Request
bash
curl -X GET '{API_URL}virtual-machines/{id}/metrics' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'refresh-token: {REFRESH_TOKEN}' \
-H 'Content-Type: application/json'
Response
json
{
"status": true,
"message": "Performance metrics retrieved successfully",
"data": {
"cpu": {
"unit": "%",
"data": [
{
"time": 1727057340,
"value": 5.0139
}
// Additional data points...
]
},
"memory": {
"unit": "%",
"data": [
{
"time": 1727057340,
"value": 0.0218
}
// Additional data points...
]
},
"disk": {
"unit": "GB",
"data": [
{
"time": 1727057340,
"read": 0.512,
"write": 4.891
}
// Additional data points...
]
},
"network": {
"unit": "GB",
"data": [
{
"time": 1727057340,
"in": 0.0004,
"out": 0.1221
}
// Additional data points...
]
}
}
}