World model (schema 1)
The contract between the collector and the frontends. A frontend only needs to know this; which source the data comes from is a detail of the collector.
Transport
GET /api/world: the current world as JSON.GET /api/events: Server-Sent Events. On connecting, aworldevent (with sequence numberseq) arrives immediately. After that, after every round of a connector (Plex relay immediately, alarms and UniFi 10 s, Zabbix and Proxmox 30 s), apatchplus zero or more events. At most once every 2 minutes a fullworldfollows again. Every 15 s a keepalive comment.sourcescontains the status per connector.- A
patchhasseq,base(theseqit applies to),generated_at,set(changed parts, such asproblemsornetwork),nodes(changed or new nodes) andremoved(vanished node ids). Ifbasedoes not match your own version, fetch/api/worldagain. The shared client (web/shared/labwereld.js) already does this; styles simply receive a world. - A
patchalso containsops: only the changed fields, so a node with one new measurement is not sent in full. Each operation is[path, value](set a field) or[path](remove a field). A path is a list of keys from the world root; a number is a position in a list, and["nodes", id, …]selects a node byid(not by position). Example:[["nodes", "web1", "metrics", "cpu_pct"], 12.5],[["sources", "zabbix", "last_success"], 1790154930]. Order of application:set, thenops, thennodes, thenremoved. The collector still sends a part or node in full (setornodes) when that is smaller, or when a list changes length (the whole list is then sent as the value). The world itself does not change (schema 1). A client that does not knowopsmisses intermediate changes until the next fullworld(at most 2 minutes); reloading fetches the new shared client. GET /api/healthz: is the collector itself alive?200as long as there is a world and the main loop has published something recently, even when a source fails;503when nothing has been published for longer than 3× the largest connector interval (at least 180 s): the collector is stuck. The response is JSON withok,version,alive,sources_ok(all sources OK?),last_publish_s(seconds since the last publication),stale_after_s(the threshold) and, for information,sources(status per source). With?strict=1the response is200only if all sources work as well. The DockerHEALTHCHECKand the deployment check use the plain variant.GET /api/stats: numbers about the collector itself only: duration per connector round and per composition (last, average, maximum), size of the world and of what is sent to browsers, cpu time and memory. No contents.GET /api/connectors: status per connector (see connectors.html);/status/shows this as a page.
Tip for frontends: animate continuously based on the latest world (interpolate between two rounds), and start one-off effects on events.
world
{
"schema": 1,
"generated_at": 1790154900, // unix time of the snapshot
"sources": { "zabbix": { "ok": true, "last_success": 1790154900, "error": null } },
"sites": [ Site ],
"links": [ Link ],
"nodes": [ Node ],
"problems":[ Problem ],
"backups": [ Backup ],
"media": { "plex": Media },
"documents": { "paperless": Documents },
"network": Network | null,
"tasks": [ Task ],
"place": Place | null
}
When a round fails, the previous contents stay and sources.<source>.ok becomes false; show a disturbance or noise, for example. Some sources tolerate a few failed rounds (UniFi: three): as long as the previous contents are still valid, ok stays true, with the last error in error and the number of consecutive failed rounds in failures.
Site
| Field | Meaning |
|---|---|
id, name | e.g. home / Home, office / Office |
node_count, up, down | node counts at this site |
alert_level | highest Zabbix severity (0–5) of nodes at this site |
wan | {rx_bps, tx_bps, gateway, source} or null: the site's internet connection (OPNsense, or UniFi for the UniFi network) |
Link
| Field | Meaning |
|---|---|
id, name, kind | e.g. home-office, wireguard |
a, b | site ids at both ends |
state | up, down, unknown |
state_reason | the evidence, e.g. a recent handshake or traffic |
rx_bps, tx_bps | bits/s, or null if not measured |
Node
| Field | Meaning |
|---|---|
id, name | stable id and display name |
site | site id (or null for an unknown auto-discovered host) |
kind | hypervisor, vm, ct, server, nas, appliance, device |
role | free label for choosing a sprite: cloud, firewall, backup, media, nas, dns, monitoring, mail, lab, dev, … |
parent, vmid | hypervisor node and Proxmox ID for guests |
state | up, down, unknown |
state_reason | why, e.g. "agent reachable", "traffic on hypervisor interface" (Dutch; the frontends translate the common ones) |
activity | idle (<5% cpu), normal (<50%), busy (<85%), overloaded, or null; with 3 percentage points of hysteresis around each threshold |
alert_level | highest severity of open Zabbix problems: 0 none, 2 warning, 3 average, 4 high, 5 disaster |
flags | cpu_high, mem_high, disk_full, hot, traffic_spike |
net_source | agent, hypervisor (Zabbix via tap/veth), proxmox or null |
metrics | see below; every field can be null |
auto_discovered | discovered by a source, not described in the topology (hide with [discovery] ignore) |
children | containers on this node (empty if there are none or the source does not know), see below |
metrics: cpu_pct, mem_pct, load1, cpu_count, uptime_s, disk_root_pct, disk_max_pct, disk_temp_max_c, net_in_bps, net_out_bps, containers_running.
children (containers): id (<node>/<name>), name, image (without registry, e.g. linuxserver/plex), state (running, exited, paused, restarting, dead, unknown), health (healthy, unhealthy, starting, or null without a health check), restarts, cpu_pct, mem_bytes (only when running), started_at. No environment variables, commands or volumes. Sources: the Docker connector, or the Zabbix template Docker by Zabbix agent 2.
Agreed thresholds (so all styles react the same): cpu_high ≥ 85%, mem_high ≥ 90%, disk_full ≥ 85% on any file system, hot ≥ 50 °C.
Problem
id, name, severity (0–5), severity_name, since, acknowledged, nodes (node ids).
Backup
| Field | Meaning |
|---|---|
id, system, label | e.g. pbs:store/home/vm/101, pbs or borg; for the open backup status <source>:<id> and the given tool (such as restic) |
source_node | node being backed up (or null if unknown) |
target_node | backup server node |
last_success, age_s, max_age_s | times in seconds |
ok | true within the norm, false too old or with an error, null unknown |
error | error message of the last attempt, or null |
Media
media.<service> (the name from [media.<service>], e.g. plex or jellyfin): node (node id the service runs on, or null), system (plex, jellyfin, … or null if unknown; added later, so may be missing), ok, count and sessions with per session key (Plex ratingKey or Jellyfin item id), type (movie, episode, track, …), title, show, state (playing, paused, buffering), progress (0–1), transcode and optionally art: {w, h, px} with px as base64 RGB (48×27 by default). No users, devices or addresses. Sources: the Plex relay, Tautulli, Jellyfin or the Zabbix items from [media.<service>] (see connectors.md). Several services may live on the same node; frontends add them up.
Documents
documents.<service> (the name from [documents.<service>], e.g. paperless): a document flow from scanner via Paperless-ngx to an optional copy elsewhere. Empty ({}) without [documents.*]. Added in 0.3.0 without raising the schema number.
| Field | Meaning |
|---|---|
system | paperless |
node | node id where the archive lives, or null |
ok | true if the Paperless API was read this round, null without a Paperless source |
total | number of documents, or null |
queued, processing | tasks waiting or being processed; null without rights on tasks |
failed | failed processing not yet dismissed in Paperless, or null |
last_added_at | time of the newest document |
recent | the 10 newest documents: id, added_at |
failures | failed processing: id (task id), at |
copy | copy elsewhere, or null: target (node id or null), label, state (ok, failed, unknown), ok, state_reason, last_run, last_success, copied_last, copied_total |
Never titles, file names, content, correspondents or tags: those name people. Sources: the Paperless API and the Zabbix items from [documents.<service>.copy] (see connectors.md).
Network
The UniFi network of one site, or null without a UniFi source:
| Field | Meaning |
|---|---|
site | site id the network belongs to |
clients | total, wired, wireless, other (counts only) |
wan | rx_bps (download) and tx_bps (upload) of the gateway |
devices | per device id, name, model, kind (gateway, switch, ap), state, clients, cpu_pct, mem_pct, uptime_s, tx_bps, rx_bps |
Task
Running and recent (24 hours) Proxmox tasks, newest first: id (UPID), type (vzdump, qmigrate, qmsnapshot, qmstart, …), site, hypervisor (node id), node (node id of the guest, or null), vmid, status (running, ok, warning, error), started_at, ended_at. No user names.
Place
Where the homelab is, for day and night in the styles; null if not set. tz (IANA time zone, e.g. Europe/Amsterdam), lat and lon (degrees; lat can be null for an unknown zone) and source (tijdzone = time zone, tijdzone (benadering) = approximation, or coördinaten = coordinates). Comes from the collector's TZ or LABWERELD_LAT/LABWERELD_LON. Added in 0.1.0 without raising the schema number: frontends that do not know it are not affected.
History
GET /api/history?node=<id> returns t plus series cpu_pct, mem_pct, net_in_bps and net_out_bps; node=_wan returns rx_bps/tx_bps of the network. 240 points (~2 hours). With LABWERELD_DATA_DIR (/data in the container) the history is saved every 5 minutes and on shutdown, and read back after a restart; points older than 3 hours are then dropped.
Events
Every event has a type (also the SSE event name) and ts.
| Type | Extra fields | Idea for a visual effect |
|---|---|---|
node.state_changed | node, old, new, reason | lights out, character knocked out / back up |
node.activity_changed | node, old, new | walking ↔ running, fan spins faster |
node.flag_raised / node.flag_cleared | node, flag | smoke, sweat drops, full cupboards |
node.appeared / node.vanished | node | a new character lands / leaves |
link.state_changed | link, old, new | tunnel collapses / is repaired |
problem.started / problem.resolved | problem | flashing light, an Emergency Meeting at severity 5 |
backup.completed | backup, system, source_node, target_node | cargo ship from source to vault |
backup.overdue / backup.recovered | backup, source_node | dusty vault, cobwebs |
traffic.spike | node, bps, baseline_bps | packet storm in the corridor |
source.lost / source.restored | source, error | static, "connection lost" |
media.started / media.stopped | service, node, session | cinema opens / closes |
clients.joined / clients.left | site, count, wireless, wired | visitor shuttles land / leave |
task.started / task.finished | task, node | loading dock: backup is loaded / cargo ship departs |
container.state_changed | node, container, old, new, health | desk empty / occupied again, or sick |
container.restarted | node, container, restarts | another coffee stain |
document.queued | service, node, count | the scanner pulls in a sheet |
document.added | service, node, count, documents (ids) | sheets fly from the scanner to the archive |
document.failed | service, node, count | a crumpled sheet |
document.copied | service, node, target, label, count | sheets fly from the archive to the copy |
document.copy_failed / document.copy_recovered | service, node, target, label (and reason) | newspaper headline |
A traffic spike is at least 4× the node's own moving average and ≥ 2 Mbit/s, with at most one spike per node per 5 minutes.