Developers
Agent protocol
How the monitoring agent talks to the panel.
๐ Overview
The monitoring agent keeps one outbound WebSocket to the panel. All traffic โ metrics, inventory, actions, command output and terminal data โ flows over it as JSON text frames. Nothing listens on the monitored server.
This page describes protocol version 1, for people auditing the agent or building integrations. To install the agent, see Fleet monitoring.
๐๏ธ Enrollment
- An admin generates an install command in the panel. It carries a one-time token (32 random bytes, valid for one hour).
- The installer calls
POST /api/fleet/agent/enrollwith the token, hostname, architecture, mode, version and machine id. - The panel answers with the server id and an agent key of the form
oa_<id>_<secret>. The panel stores only a SHA-256 hash of the key. - The key is written to
/etc/orchestrator-agent/agent.json, readable only by root (and theorch-agentgroup in monitor mode).
{
"panel": "https://panel.example.com",
"serverId": 7,
"agentKey": "oa_7_โฆ",
"mode": "control",
"allowTerminal": true,
"allowCommands": true
}
A missing switch counts as false.
๐ Connection
GET /api/terminal/fleet/agent HTTP/1.1
Host: panel.example.com
Upgrade: websocket
Authorization: Bearer oa_7_โฆ
X-Agent-Version: 1.0.0+3a1b2c4
| Situation | Result |
|---|---|
| Wrong or revoked key | HTTP 401 before the upgrade, or close code 4401 |
| A second connection with the same key | the older connection is closed with 4409 |
| Connection lost | reconnect with exponential back-off from 2 to 60 seconds (ยฑ20% jitter); every 60 seconds after a 401 |
Keep-alive: the panel sends a WebSocket ping every 25 seconds and an application ping every 30 seconds to measure latency. Either side drops a connection that has been silent for 90 seconds. Frames are limited to 4 MiB.
โ๏ธ Messages
| From the panel | Purpose |
|---|---|
welcome |
Connection accepted; sends the reporting intervals. |
live |
Someone is watching: report every 2 seconds instead of 15. |
ping |
Latency check. |
inventory, processes |
Request services, containers and updates, or the process list. |
action |
Run a fixed action (service.restart, reboot, packages.update, docker.start โฆ). |
exec |
Run a command (control mode with allowCommands). |
logs |
Read or follow the journal or a file under /var/log. |
cancel |
Cancel a running request. |
pty.open, pty.in, pty.resize, pty.close |
Terminal session (control mode with allowTerminal). |
update |
Install a new agent build. |
| From the agent | Purpose |
|---|---|
hello |
Version, mode and capabilities after connecting. |
metrics |
A metrics sample. |
inventory, processes |
The requested data. |
result |
The final result of a request. |
chunk |
Streaming output of a running request. |
pty.data, pty.exit |
Terminal output and exit. |
pong |
Latency answer. |
error |
A request was refused or failed, for example forbidden: monitor mode or busy. |
๐ What is collected
- Every 15 seconds (every 2 seconds while watched): CPU total, per core, steal and I/O wait; load 1/5/15; memory and swap; every real filesystem with inodes; disk I/O; network rates and totals per physical interface; uptime; process count; established TCP connections.
- Every 5 minutes: systemd services and failed units, Docker containers, pending and security updates, reboot required, OS, kernel, hostname and timezone.
The agent reads no application data, no files outside /var/log (and only on request), and sends nothing to anyone but your panel.
๐ฎ Enforcement on the agent
The agent itself decides what it allows โ the panel cannot override it:
| Request | Monitor mode | Control mode |
|---|---|---|
| Metrics, inventory, processes, logs, service status | โ | โ |
| Fixed actions | forbidden: monitor mode |
โ |
exec |
forbidden: monitor mode |
only with allowCommands |
pty.open |
forbidden: monitor mode |
only with allowTerminal |
update |
forbidden: monitor mode |
only with allowCommands |
Limits: 8 requests and 4 terminals at a time; output is streamed in 64 KiB chunks, up to 32 MiB per request.
๐ Updates
An update message carries a version, a URL and a SHA-256 checksum. The agent only accepts a URL on the panel's own origin, downloads the file next to itself, checks that it is a Linux executable with the right checksum, replaces itself and exits so systemd starts the new version. It refuses to update while requests are running.