Skip to content

Retrieve VM Instance Performance Metrics ​

Retrieves performance metrics data for a virtual machine. Provide the virtual machine ID in the path to retrieve the following data for the specified virtual machine: CPU usage, memory usage (RAM), network, and disk. The optional duration parameter can be used to specify the period for retrieving performance metrics; the default value will retrieve all available data.

HTTP Request ​

GET {API_URL}virtual-machines/{id}/metrics

Path parameters ​

ParametersRequirementsTypeDescription
idRequiredstringThe id of the virtual machine from which to retrieve performance metrics.details.
durationOptionalstringSpecifies the time period for retrieving performance metrics. If no duration is specified, all recorded performance metrics are returned.Possible enum values: 1h, 2h, 4h, 6h, 12h, 1d, 3d, 7d, 15d, 30d

Reponse Attributes ​

status boolean ​

Indicates the status of the request to retrieve a VM Instance performance metrics. true signifies success, while false indicates an error.

message string ​

A description of the status of the request.

data object ​

The performance metrics data.

Attributes ​
  • cpu object: An object containing CPU usage metrics.
  • memory object: An object containing memory usage metrics.
  • network object: An object containing network input and output metrics.
  • disk object: An object containing disk write and read metrics.

Example ​

Request ​

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 ​

{
    "status": true,
    "message": "Getting metrics successful",
    "data": {
        "cpu": {
            "unit": "%",
            "data": [
                {
                    "time": 1727057340,
                    "value": 5.0139
                },
                {
                    "time": 1727057640,
                    "value": 0.3222
                },
                {
                    "time": 1727057940,
                    "value": 0.3972
                },
                {
                    "time": 1727058240,
                    "value": 0.3083
                },
                {
                    "time": 1727058540,
                    "value": 0.3111
                },
                {
                    "time": 1727058840,
                    "value": 0.3028
                },
                {
                    "time": 1727059140,
                    "value": 0.3083
                },
                {
                    "time": 1727059440,
                    "value": 0.3083
                },
                {
                    "time": 1727059740,
                    "value": 1.5583
                }
            ]
        },
        "memory": {
            "unit": "%",
            "data": [
                {
                    "time": 1727057340,
                    "value": 0.0218
                },
                {
                    "time": 1727057640,
                    "value": 0.0218
                },
                {
                    "time": 1727057940,
                    "value": 0.0218
                },
                {
                    "time": 1727058240,
                    "value": 0.0218
                },
                {
                    "time": 1727058540,
                    "value": 0.0218
                },
                {
                    "time": 1727058840,
                    "value": 0.0218
                },
                {
                    "time": 1727059140,
                    "value": 0.0218
                },
                {
                    "time": 1727059440,
                    "value": 0.0218
                },
                {
                    "time": 1727059740,
                    "value": 0.0215
                }
            ]
        },
        "disk": {
            "unit": "GB",
            "data": [
                {
                    "time": 1727057340,
                    "read": 0.512,
                    "write": 4.891
                },
                {
                    "time": 1727057640,
                    "read": 0.512,
                    "write": 4.8918
                },
                {
                    "time": 1727057940,
                    "read": 0.5134,
                    "write": 4.8927
                },
                {
                    "time": 1727058240,
                    "read": 0.5134,
                    "write": 4.8927
                },
                {
                    "time": 1727058540,
                    "read": 0.5134,
                    "write": 4.8927
                },
                {
                    "time": 1727058840,
                    "read": 0.5134,
                    "write": 4.8927
                },
                {
                    "time": 1727059140,
                    "read": 0.5136,
                    "write": 4.893
                },
                {
                    "time": 1727059440,
                    "read": 0.5136,
                    "write": 4.893
                },
                {
                    "time": 1727059740,
                    "read": 0.6736,
                    "write": 4.9837
                }
            ]
        },
        "network": {
            "unit": "GB",
            "data": [
                {
                    "time": 1727057340,
                    "in": 0.0004,
                    "out": 0.1221
                },
                {
                    "time": 1727057640,
                    "in": 0.0004,
                    "out": 0.1221
                },
                {
                    "time": 1727057940,
                    "in": 0.0004,
                    "out": 0.1221
                },
                {
                    "time": 1727058240,
                    "in": 0.0004,
                    "out": 0.1221
                },
                {
                    "time": 1727058540,
                    "in": 0.0004,
                    "out": 0.1221
                },
                {
                    "time": 1727058840,
                    "in": 0.0004,
                    "out": 0.1221
                },
                {
                    "time": 1727059140,
                    "in": 0.0004,
                    "out": 0.1222
                },
                {
                    "time": 1727059440,
                    "in": 0.0004,
                    "out": 0.1222
                },
                {
                    "time": 1727059740,
                    "in": 0.0004,
                    "out": 0.1222
                }
            ]
        }
    }
}