Skip to main content

Node management

OSAPI can query and update system-level information on managed nodes. All node operations run through the job system, so the API server never needs direct access to the host.

Agent vs. node​

OSAPI separates agent fleet discovery from node system queries:

  • Agent commands (agent list, agent get) read the NATS KV heartbeat registry directly. They show the agents that are online, their labels, a small set of metrics and the node conditions of the last heartbeat. They make no jobs. Agents also have typed system facts (architecture, kernel version, FQDN, CPU count, network interfaces, service manager, package manager). Providers collect them every 60 seconds, and the agent stores them in a separate agent-facts KV bucket with a 5-minute TTL. The API puts the registry data and the facts together in one AgentInfo response. You can drain an agent for maintenance. The process continues to run.
  • Node commands (node hostname, node status) send jobs to agents. The agents run system commands and return detailed results, for example the disk usage and all of the memory data.

What it manages​

ResourceDescription
HostnameGet the hostname, or set it on Debian
StatusUptime, OS name and version, kernel, platform info
UptimeThe time since the host started
OSThe distribution and its version
DiskThe size, used and free space of each local filesystem
MemoryThe total, used and free memory
LoadThe 1, 5 and 15 minute load averages
System FactsArchitecture, kernel, FQDN, CPUs, NICs, routes, service/pkg mgr

How it works​

Node queries are jobs. The CLI sends a job to the API server. The API server publishes it to NATS. An agent receives it, reads the requested system information and writes the result back to NATS KV. The CLI asks for the result and shows it.

When part of a status cannot be read​

node status is the status behavior. It runs six separate reads: hostname, uptime, OS, load, memory and disks. When one read fails, the others still return. The response names the failure in errors, and does not show a zero. A zero value looks the same as a host with nothing to report.

Each item of errors is the name of the read and its error:

{
"hostname": "web-01",
"status": "ok",
"name": "web-01",
"uptime": { "uptime": "4 hours, 1 minute", "seconds": 14460 },
"errors": ["memory: open /proc/meminfo: permission denied"]
}

The status of the row stays ok, because the operation ran and the agent answered.

The network and command operations are also under node. Refer to Network Management and Command Execution for those domains.

You can target a specific host, broadcast to all hosts, or route by label. Refer to Node CLI Reference for job-based commands and Agent CLI Reference for registry-based fleet discovery, or the API Reference for the REST endpoints.

Configuration​

Node management uses the general job system. It needs no configuration of its own. Refer to Configuration for NATS, agent, and authentication settings.

Permissions and platforms​

The generated page of each behavior gives the permission, the platforms and the route of each method: status, hostname, uptime, os, disk, memory, load. The pages come from the definitions, so they stay true when a method changes, and this page does not copy them. Authentication tells which permissions each role has.

Agent fleet discovery is not a behavior: its endpoints need agent:read.