Skip to content

Metrics

Introduction

The Metrics API provides endpoints to retrieve performance metrics for a specific box. This includes CPU, memory, and storage usage statistics.


CPU usage

Get CPU usage for a specific box by ID.

Endpoint

GET /v1/boxes/{id}/metrics/cpu

Request Parameters

Parameter Location Type Required Description
id Path string Yes The ID of the box
Authorization Header string Yes Bearer token (JWT)

Responses

Success Response

  • Status Code: 200 OK
  • Description: Response contains the CPU metrics for the specific box
  • Body:
{
"values": [0.5, 2.3, 7, 3.5, 0.01],
"labels": [ ...
"2024-11-30T15:52:00.000000Z",
"2024-11-30T15:53:00.000000Z",
"2024-11-30T15:54:00.000000Z",
"2024-11-30T15:55:00.000000Z",
"2024-11-30T15:56:00.000000Z"
]
}
Field Type Description
values array CPU usage percentage values over time (0-100)
labels array ISO 8601 timestamps corresponding to each value

Error Responses

401 Unauthorized
{
"timestamp": "timestamp",
"path": "/v1/boxes/{id}/metrics/cpu",
"request_id": "request-id",
"message": "Unauthenticated."
}
400 Bad Request
{
"timestamp": "timestamp",
"message": "The selected box id is invalid.",
"path": "/v1/boxes/{id}/metrics/cpu",
"request_id": "3d4379f2-7ceb-4e1e-aa36-cb45f82dd85f"
}

Memory usage

Get memory usage for a specific box by ID.

Endpoint

GET /v1/boxes/{id}/metrics/memory

Request Parameters

Parameter Location Type Required Description
id Path string Yes The ID of the box
Authorization Header string Yes Bearer token (JWT)

Responses

Success Response

  • Status Code: 200 OK
  • Description: Response contains the memory metrics for the specific box
  • Body:
{
"values": [0.07, 0.09, 0.12, 0.08, 0.06],
"labels": [ ...
"2024-11-30T15:52:00.000000Z",
"2024-11-30T15:53:00.000000Z",
"2024-11-30T15:54:00.000000Z",
"2024-11-30T15:55:00.000000Z",
"2024-11-30T15:56:00.000000Z"
]
}
Field Type Description
values array Memory usage values in GB over time
labels array ISO 8601 timestamps corresponding to each value

Error Responses

401 Unauthorized
{
"timestamp": "timestamp",
"path": "/v1/boxes/{id}/metrics/memory",
"request_id": "request-id",
"message": "Unauthenticated."
}
400 Bad Request
{
"timestamp": "timestamp",
"message": "The selected box id is invalid.",
"path": "/v1/boxes/{id}/metrics/memory",
"request_id": "3d4379f2-7ceb-4e1e-aa36-cb45f82dd85f"
}

Storage usage

Get storage usage for a specific box by ID.

Endpoint

GET /v1/boxes/{id}/metrics/storage

Request Parameters

Parameter Location Type Required Description
id Path string Yes The ID of the box
Authorization Header string Yes Bearer token (JWT)

Responses

Success Response

  • Status Code: 200 OK
  • Description: Response contains the storage metrics for the specific box
  • Body:
{
"data": {
"files": {
"total": 27439,
"used": 3480,
"free": 7255
},
"database": {
"total": 60324,
"used": 3407,
"free": 8743
},
"additional_storage": 6520
}
}
Field Type Description
files.total integer Total file storage in bytes
files.used integer Used file storage in bytes
files.free integer Free file storage in bytes
database.total integer Total database storage in bytes
database.used integer Used database storage in bytes
database.free integer Free database storage in bytes
additional_storage integer Additional storage capacity in bytes

Error Responses

401 Unauthorized
{
"timestamp": "timestamp",
"path": "/v1/boxes/{id}/metrics/storage",
"request_id": "request-id",
"message": "Unauthenticated."
}
400 Bad Request
{
"timestamp": "timestamp",
"message": "The selected box id is invalid.",
"path": "/v1/boxes/{id}/metrics/storage",
"request_id": "3d4379f2-7ceb-4e1e-aa36-cb45f82dd85f"
}