Skip to content

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

ParameterRequirementTypeDescription
idRequiredstringTarget instance's unique identifier
durationOptionalstringTime 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 metrics
  • memory: RAM utilization statistics
  • network: Input/Output bandwidth measurements
  • disk: 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...
            ]
        }
    }
}