Fetch machine metrics data
POSThttps://cloud-api.sandbox-v1.mecha.build/api/v1/machines/metrics
This API endpoint retrieve metrics data for the machine identified by the provided machineId or machine alias, filtered by the specified metrics label. Note that metrics data is only collected if metrics collection is enabled in machine telemetry. Machine metrics refer to quantitative data points that provide insight into the performance, health, and utilization of a machine.
Request
- application/json
Body
required
The request body containing the required details to get machine metrics
metricsLabel stringrequired
Possible values: [SYSTEM_CPU_UTILIZATION
, SYSTEM_MEMORY_USAGE
, SYSTEM_CPU_LOAD_AVERAGE_15M
, SYSTEM_NETWORK_IO
, SYSTEM_DISK_IO
, SYSTEM_FILESYSTEMS_USAGE
]
start int64required
Timestamp in epoch seconds
end int64required
Timestamp in epoch seconds
machineIdOrAlias stringrequired
timeInterval stringrequired
Responses
- 200
Success response
- application/json
- Schema
- Example (from schema)
- Fetch machine metrics data example
Schema
success boolean
message string
status string
statusCode int32
errorCode string
subErrors object[]
payload
object
{
"success": true,
"message": "string",
"status": "string",
"statusCode": 0,
"errorCode": "string",
"subErrors": [
{}
],
"payload": {
"status": "string",
"data": {
"resultType": "string",
"result": [
{
"metric": {
"state": "string",
"device": "string",
"machine_id": "string",
"direction": "string",
"type": "string",
"system_cpu_logical_number": "string"
},
"values": [
[
{}
]
]
}
]
}
}
}
Fetch machine metrics data response example
{
"success": true,
"message": "Machine metrics fetched successfully",
"status": "OK",
"statusCode": 200,
"errorCode": "",
"subErrors": [
{}
],
"payload": {
"status": "success",
"data": {
"resultType": "matrix",
"result": [
{
"metric": {
"state": null,
"device": "eth0",
"machine_id": "xxb63e2aaedx-xxxx-123",
"direction": "receive",
"type": null,
"system_cpu_logical_number": null
},
"values": [
[
1717747560,
"7"
],
[
1717747620,
"8"
]
]
}
]
}
}
}
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
ResponseClear