Skip to main content

Node resource stats

CamusDB exposes the disk, CPU, and memory state of the node that receives a request. This gives operators and monitoring systems a lightweight way to check whether a node has enough resources to keep serving traffic, especially whether its data volume is approaching the write-admission watermark.

  • REST: GET /v1/admin/stats
  • gRPC: CamusSql.GetNodeStats

The call is node-local, so query every node separately when you monitor a cluster. It reads cached samples and does not scan the database on the request path.

Authorization​

With authentication disabled, anyone who can reach the endpoint can call it. With authentication enabled, the caller must be a superuser or hold the global MONITOR privilege:

CREATE USER monitoring IDENTIFIED BY 'use-a-secret';
GRANT MONITOR ON *.* TO monitoring;

MONITOR is valid only on *.*. It is intentionally outside ALL PRIVILEGES and grants no access to application data. An account with only MONITOR sees no databases through SHOW DATABASES.

Other authenticated users receive CADB0517 InsufficientPrivilege, as HTTP 403 or gRPC PERMISSION_DENIED.

Call the endpoint​

curl -s \
-H "Authorization: Bearer $TOKEN" \
https://db1.example.com:7141/v1/admin/stats

With the .NET driver, over REST or gRPC:

CamusNodeStats stats = await connection.GetNodeStatsAsync();
CamusDiskVolumeStats? data = stats.DataVolume;

if (data is { BelowWatermark: true })
Console.WriteLine("This node is refusing new writes");

GetNodeStatsAsync() queries the next endpoint in the connection's rotation. Use GetNodeStatsAsync(endpoint) to ask a specific node. The endpoint must be one of the entries in the connection string's Endpoint.

Returned data​

The REST response uses camel-case field names. gRPC uses the corresponding snake-case protobuf fields.

Node identity​

FieldMeaning
nodeIdThe node's id within the cluster. It can be empty early during startup.
endpointThe node's internal cluster address.
versionServer version and build commit.
clusterModeWhether the node runs in cluster mode.
uptimeSecondsWhole seconds since process startup.
sampledAtUnixMsTime when the reply was assembled.

Disk volumes​

The first disk entry has role data. A second entry with role wal appears when the write-ahead log (WAL) directory is mounted on another volume.

FieldMeaning
role, path, mountPointThe role and location of the measured volume.
totalBytes, freeBytes, availableBytes, usedBytesCapacity and currently available space.
minFreeDiskBytesThe write-admission watermark for the data volume.
belowWatermarkWhether this node currently refuses new writes for insufficient space.
engineBytesBytes occupied by the storage engine and, when colocated, its WAL.

belowWatermark comes from the same probe used by the write gate. When it is true, writes fail with CADB0536 InsufficientDiskSpace; reads, DDL, and DROP remain available so an operator can investigate or free space. Alert before that point, for example when available space falls below several times the configured watermark.

CPU​

FieldMeaning
processCpuPercentProcess CPU as a percentage of the whole node.
processCpuWindowMsSampling window, normally 60 seconds.
processorCountProcessors visible to .NET, including container CPU limits.
loadAverage1m, loadAverage5m, loadAverage15mHost load averages on Linux and macOS.

Memory​

FieldMeaning
processWorkingSetBytesResident memory of the CamusDB process.
gcHeapBytesManaged heap size.
gcCommittedBytesMemory committed by the garbage collector.
gcMemoryLimitBytesEffective managed heap limit. 0 means no limit is configured.
hostTotalBytes, hostAvailableBytesMemory available to the node, respecting Linux cgroup limits.

Missing measurements and sample age​

A measurement that the node cannot read is -1, never 0. The errors array identifies the field and explains why it was unavailable. One failed probe does not fail the whole response.

Disk capacity is at most two seconds old. CPU, load, and host memory samples are at most five seconds old. Engine size and mount layout are refreshed every 60 seconds. Working-set and GC values come directly from the runtime.