Granular metrics requests
Granular metrics collection requests
| Method |
Path |
Description |
| GET |
/v1/metrics/granular/status |
Get the granular metrics collection status of cluster nodes |
| POST |
/v1/metrics/granular/start |
Start granular metrics collection |
| POST |
/v1/metrics/granular/stop |
Stop granular metrics collection |
| DELETE |
/v1/metrics/granular/data |
Delete granular metrics data |
These requests manage the granular tier of local metrics storage. None of them take a request body.
Get granular metrics status
GET /v1/metrics/granular/status
Get the granular metrics collection status of all nodes or of a specific node.
Required permissions
Request
Example HTTP request
GET /v1/metrics/granular/status
| Key |
Value |
Description |
| Host |
cnm.cluster.fqdn |
Domain name |
| Accept |
application/json |
Accepted media type |
Query parameters
| Field |
Type |
Description |
| node_uid |
integer |
Optional. The ID of the node to get the status of. If omitted, returns the status of all nodes. |
Response
Returns a nodes array with one object for each node in scope.
Example JSON body
{
"nodes": [
{ "uid": "1", "state": "running", "started_at": 1771770600, "expires_in_sec": 2820 },
{ "uid": "2", "state": "stopped", "stopped_at": 1771770600, "auto_cleanup_in_sec": 82800, "disk_usage_bytes": 131072000 }
]
}
Node status fields
Timestamps are Unix epoch seconds.
| Field |
Type |
Description |
| uid |
string |
The node ID |
| state |
string |
Granular collection state on the node:
running
stopped |
| started_at |
integer |
When collection started. Included only while state is running. |
| expires_in_sec |
integer |
Seconds until collection stops automatically. Included only while state is running. |
| stopped_at |
integer |
When collection stopped. Included only after collection stops, while granular data is still on disk. |
| auto_cleanup_in_sec |
integer |
Seconds until the granular data is deleted automatically. Included only after collection stops, while granular data is still on disk. |
| disk_usage_bytes |
integer |
Disk space used by granular data, in bytes |
Status codes
Start granular metrics collection
POST /v1/metrics/granular/start
Start granular metrics collection on all nodes or on a specific node. Collection stops automatically after the maximum duration set in granular_metrics_job_settings.
The request is idempotent. Starting collection on a node where it's already running returns already_running.
Required permissions
Request
Example HTTP request
POST /v1/metrics/granular/start
| Key |
Value |
Description |
| Host |
cnm.cluster.fqdn |
Domain name |
| Accept |
application/json |
Accepted media type |
Query parameters
| Field |
Type |
Description |
| node_uid |
integer |
Optional. The ID of the node to start collection on. If omitted, starts collection on all nodes. |
Response
Returns a results array with one object for each node in scope.
Example JSON body
{
"results": [
{ "uid": "1", "outcome": "started", "started_at": 1771770600, "expires_at": 1771774200 },
{ "uid": "2", "outcome": "already_running", "started_at": 1771769000, "expires_at": 1771772600 },
{ "uid": "3", "outcome": "unknown" }
]
}
Result fields
Timestamps are Unix epoch seconds.
| Field |
Type |
Description |
| uid |
string |
The node ID |
| outcome |
string |
Result on the node:
started: collection started.
already_running: collection was already running.
unknown: the result couldn't be confirmed. Get the granular status of the node to check. |
| started_at |
integer |
When collection started |
| expires_at |
integer |
When collection stops automatically |
Status codes
Stop granular metrics collection
POST /v1/metrics/granular/stop
Stop granular metrics collection on all nodes or on a specific node. The collected data stays on disk until it's deleted or the cleanup delay set in granular_metrics_job_settings passes.
The request is idempotent. Stopping collection on a node where it isn't running returns already_stopped.
Required permissions
Request
Example HTTP request
POST /v1/metrics/granular/stop
| Key |
Value |
Description |
| Host |
cnm.cluster.fqdn |
Domain name |
| Accept |
application/json |
Accepted media type |
Query parameters
| Field |
Type |
Description |
| node_uid |
integer |
Optional. The ID of the node to stop collection on. If omitted, stops collection on all nodes. |
Response
Returns a results array with one object for each node in scope.
Example JSON body
{
"results": [
{ "uid": "1", "outcome": "stopped", "stopped_at": 1771774200, "ran_for_sec": 3600 },
{ "uid": "2", "outcome": "already_stopped" }
]
}
Result fields
| Field |
Type |
Description |
| uid |
string |
The node ID |
| outcome |
string |
Result on the node:
stopped: collection stopped.
already_stopped: collection wasn't running. |
| stopped_at |
integer |
When collection stopped, in Unix epoch seconds |
| ran_for_sec |
integer |
How long collection ran, in seconds |
Status codes
Delete granular metrics data
DELETE /v1/metrics/granular/data
Delete granular metrics data from all nodes or from a specific node.
If granular collection is still running on any node in scope, the request fails with 409 Conflict. The cluster is checked before any node's data is deleted, so a failed request deletes nothing. Stop collection on those nodes first.
Required permissions
Request
Example HTTP request
DELETE /v1/metrics/granular/data
| Key |
Value |
Description |
| Host |
cnm.cluster.fqdn |
Domain name |
| Accept |
application/json |
Accepted media type |
Query parameters
| Field |
Type |
Description |
| node_uid |
integer |
Optional. The ID of the node to delete granular data from. If omitted, deletes granular data from all nodes. |
Response
Returns a results array with one object for each node in scope.
Example JSON body
{
"results": [
{ "uid": "1", "outcome": "deleted", "freed_bytes": 131072000 },
{ "uid": "2", "outcome": "no_data" }
]
}
Result fields
| Field |
Type |
Description |
| uid |
string |
The node ID |
| outcome |
string |
Result on the node:
deleted: granular data was deleted.
no_data: the node had no granular data to delete. |
| freed_bytes |
integer |
Disk space freed, in bytes. Included with the deleted outcome. |
Example error response
If granular collection is still running on any node in scope, the response lists those nodes:
{
"error_code": "granular_metrics_running",
"description": "cannot cleanup granular metrics — still running on 1 node(s)",
"running_nodes": [ { "uid": "1", "started_at": 1771770600 } ]
}
Status codes
| Code |
Description |
| 200 OK |
Success. |
| 404 Not Found |
The node_uid doesn't match a node in the cluster (error_code: node_not_found). |
| 409 Conflict |
Granular collection is still running on at least one node in scope (error_code: granular_metrics_running). No data was deleted. |
| 500 Internal Server Error |
Internal server error. |