Logo
OpenScaler

Retrieve aggregate live stats

GET
/v1/stats/live

Get live stats for all VMs, VPCs, and other resources (Useful for dashboard).

Notes :

  • sometimes the reply might be delayed for few seconds, this will happen if you request was sent while new stats are being written.

Authorization

bearer_auth
AuthorizationBearer <token>

OAuth Authentication

OpenScaler API uses OAuth, a standard for secure authorization. To access the API, obtain a token via the OpenScaler Platform.

Use the access_token in the Authorization header for requests:

Authorization: Bearer <token>

Always keep your token secure and do not share it with anyone.

In: header

Query Parameters

project_id*string

ID of the project used to filter results.

Response Body

application/json

application/json

text/pain

application/json

application/json

curl -X GET "https://example.com/v1/stats/live?project_id=default"
{  "timestamp": 1713525285,  "step": 5,  "data": {    "cpu": 53.1261,    "memory.used": 2543343553.3566084,    "memory.total": 4294967296,    "disk.read": 2446788.2,    "disk.write": 3507564.04,    "disk.allocation": 70368256460.6,    "disk.capacity": 107374182400,    "disk.usage": 65.53554577808828,    "block_storage.read": 2669941.64,    "block_storage.write": 2375633,    "block_storage.allocation": 3148015832.2,    "block_storage.capacity": 10737418240,    "block_storage.usage": 58.636364195495844,    "network.rx": 2132314.2800000003,    "network.tx": 3001534.4000000004,    "vms": [      {        "vm_id": "cc3ccab2-0ae2-11ef-9136-6a0922f6458b",        "name": "my-example-computer",        "state": "running",        "region": "alg1",        "created_at": "2024-04-19T11:13:49",        "os": "debian-13",        "cpu": 100,        "memory.used": 469027631.7276006,        "memory.total": 2147483648,        "disk.read": 968189.2,        "disk.write": 1479661.64,        "disk.allocation": 19540550470.6,        "disk.capacity": 53687091200,        "disk.usage": 36.39711154736578,        "network.rx": 804.24,        "network.tx": 1355.08      }    ],    "vpcs": [      {        "vpc_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",        "network.rx": 1026426.56,        "network.tx": 1302641.2799999998      },      {        "vpc_id": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11",        "network.rx": 1105887.72,        "network.tx": 1698893.1200000003      }    ]  }}
{  "errors": [    {      "message": "'vcpus' field must be an integer",      "field": "resource_id"    }  ]}
"Access denied"
{  "errors": [    {      "message": "User not initialized (missing required fields in token), please init user by sending POST request to `/v1/init` then refresh your token\n"    }  ]}
{  "errors": [    {      "message": "VM with ID 23 not found"    }  ]}