Skip to content
Sign in

system

v0.1.2

The machine the engine runs on — CPU and each core, memory and swap, load, temperatures, fans, power, pressure, the battery, GPUs, disk I/O and space, SSD health, and network, now (system::snapshot) and over 24 hours (system::history), sampled every second only while someone observes system::on-sample; the busiest processes, each worker's usage and each container's while observed; plus the System page of the iii app.

Install

bash
iii call compose::add worker=system@next

Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.

iii-config.yaml
- disks:
    exclude:

    include:

  idle_interval_ms: 10000
  net:
    exclude:

    include:

  observed_interval_ms: 1000
  volumes:
    exclude:

system

The machine the engine runs on, as an iii worker: CPU (each core too), memory and swap, load, temperatures, fans, power, pressure, the battery, GPUs, disk I/O and space, SSD health, and network. system::snapshot answers everything now, system::history up to 24 hours of each figure, and system::on-sample sends every sample to whoever observes it. The worker samples every second while someone observes and every 10 seconds otherwise, reads /proc and /sys on Linux and IOKit on macOS without starting any process, and keeps its history in memory (a restart starts it empty). While someone observes them, and only then, it also lists the busiest processes, what each iii worker uses, and each container. The iii app shows it all on its System page, and on Home in the widgets below.

Install

iii call compose::add worker=system

Linux (x86_64, arm64, armv7) and macOS. There is no Windows build. NVIDIA GPUs are read through NVML when the driver is installed. AMD GPUs are read from sysfs and Apple Silicon GPUs through IOKit. Intel GPUs are left out, because the kernel gives no busy figure for them without perf.

Quickstart

use iii_sdk::{CallRequest, InitOptions, register_worker};
use serde_json::json;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let iii = register_worker("ws://localhost:49134", InitOptions::default());

    let history = iii.call(CallRequest {
        function_id: "system::history".into(),
        payload: json!({ "series": ["cpu", "ram", "net.rx"], "window": "15m" }),
        action: None,
        timeout_ms: Some(5_000),
    }).await?;

    println!("{history:#}");
    Ok(())
}
{ "window": "15m", "step_s": 10, "end_at": 1764400000000,
  "series": { "cpu": [12.4, 9.8, null, 31.0],
              "ram": [48.2, 48.3, null, 48.9],
              "net.rx": [1200, 980, null, 15400] } }

The windows are 1m (60 points, one a second, filled only while someone observes), 15m (90 points of 10 s), 1h (60 of a minute) and 24h (96 of 15 minutes). The newest point is the slot in progress. A gap is null. Leave series out to get every series.

Key Unit What
cpu % all cores busy
ram, swap % used of total
load 1-minute load average
cpu:<n> % each logical CPU busy
temp °C the CPU's sensor; temp:<id> for every sensor of the snapshot's temps (a GPU's own is temp:gpu:<gpu id>, temp:gpu:card1; its others temp:gpu:card1.junction)
fan:<id> RPM each fan that reports its speed (none on macOS)
gpu, vram % the GPU with the most memory; gpu:<id>, vram:<id> for each
power.gpu W every GPU's power draw together; power.gpu:<id> for each that reports it
power.cpu W the CPU package (RAPL; readable only by root on most distributions)
psi.cpu, psi.mem, psi.io % time some task stalled on CPU, memory or I/O (Linux PSI); on macOS psi.mem only, the kernel's memory pressure level (normal 0, warning 50, critical 100)
battery % charge
disk.read, disk.write B/s all physical disks; disk.read:<id> for each
space % /; space:<mount> for each volume
net.rx, net.tx B/s all physical interfaces; net.rx:<id> for each

A series the machine lacks (no battery, no fan, no GPU) is absent. The temperatures other than the CPU's, the fans and the battery are read every 4.5 seconds and repeat between reads: each sits behind a slow bus.

system::snapshot ({}) answers the host (name, OS, kernel, uptime, and virtual: "container" | "vm" when it can tell), the CPU (model, threads, usage, each core's usage, clock, load), memory and swap in bytes, every temperature sensor with its limit (max, when the hardware gives one), the fans, the power figures, the pressure, the battery (pct, state, time_s, health_pct, cycles), each NVMe drive's health (wear_pct, written_bytes, errors, power_on_h, read at most once an hour; or error: "permission" on Linux, where the health log needs root), each GPU, disk, volume and interface, and the names of the virtual interfaces (Docker's bridges and veths, tunnels) it leaves out.

system::volumes, system::gpus, system::interfaces, system::disks and system::sensors ({}) answer { options: [{ value, label, detail? }] }, ready for a picker: the value is the id the series use (/, card1, enp8s0, nvme0n1, nvme0), the detail the volume's use, the GPU's memory (16 GB), Wi-Fi or Ethernet · 1 Gb/s, the disk's model and size, or the sensor's limit. The GPUs, interfaces and disks start with the choice that stands for them all, value "" (the series without a colon: gpu, net.rx, disk.read): Automatic (the GPU with the most memory), All interfaces, All disks.

Configuration

observed_interval_ms: 1000              # one sample a second while system::on-sample is observed
idle_interval_ms: 10000                 # one every 10 seconds otherwise
net: { include: [], exclude: [] }       # globs over interface names; empty include = the physical ones
disks: { include: [], exclude: [] }     # globs over block devices; empty include = whole physical disks
volumes: { exclude: [] }                # globs over mount points to leave out

include admits virtual devices too (include: ["eth*"] inside a container, where eth0 has no device behind it). The devices are found again every minute and on each snapshot.

Event functions

Function Args Called when Event (what observers receive)
system::on-sample none Every sample: each second while it has an observer; a new observer first gets the latest sample, sent to it alone { "at": 1764400000500, "values": { "cpu": 12.4, "ram": 48.2, "temp": 61.5, "disk.read": 0, … } }
system::on-processes none Every 3 seconds while it has an observer, never otherwise; a new observer gets its first event alone, as soon as two scans a second apart measured something { "at": …, "processes": [{ "pid": 4182, "name": "java", "cpu": 180.4, "mem": 2283458560 }] }: the 10 busiest and the 10 largest, by CPU (% of one core)
system::on-workers none As on-processes { "at": …, "workers": [{ "name": "system", "kind": "worker", "pids": [5120], "cpu": 0.3, "mem": 9437184 }, { "name": "engine", "kind": "engine", … }] }: each iii worker connected to the engine and running here, with every process it started, and the engine
system::on-containers none As on-processes { "at": …, "containers": [{ "id": "6829e3056f35", "name": "postgres", "cpu": 0.2, "mem": 31219712 }] }; "unsupported": true without cgroup v2 or a container runtime, and on macOS
let follow = iii.observe(Source::function("system::on-sample"), "my-worker::on-machine");
follow.ready().await?;

Observing is what makes the worker sample every second, and what makes it scan processes, workers or containers at all, so dispose of the observer when nothing shows the figures anymore. Rates are computed over the time that actually passed between two samples.

Home widgets

The iii app lists these on Home (the worker leaves out the ones whose hardware the machine lacks). Each follows the worker only while it is on screen, and opens the System page.

Widget Sizes What it shows
Machine S M L XL The metrics you pick (CPU, memory, temperature, GPU, GPU memory, disk, network, space, load, swap) over the window you pick; at L and XL a layout: a chart, a grid, one metric large, rings, an overlay or a list
GPU S M L How busy a GPU is, its memory, temperature and power (pick the GPU, or Automatic: the one with the most memory)
Temperatures M L XL Every sensor, tinted by how close it is to its own limit
Traffic M L XL Network or disk traffic mirrored, in above the line and out below, for all devices or the one you pick
Volumes M L How full each volume is, the fullest first
Health S M All normal, or what has stayed past its limit: the CPU at 85 % for 5 minutes, memory at 90 %, a volume 90 % full, a temperature near its limit
Processes M L XL The processes using the most CPU or memory
iii workers M L XL Each iii worker's CPU and memory, its whole process tree
Load S M The 1, 5 and 15 minute load against the CPU threads
This machine M L The name, OS, uptime, CPU, kernel, memory and GPUs; at L also the storage, the disks and the interfaces
Cores M L XL Each logical CPU as a thin bar in a heat map, coloured by how busy it is
Power S M L The watts the GPUs draw together, and the CPU's when the worker may read it
Fans M L Each fan's speed, at L over the last 15 minutes
Pressure S M L How much of the time tasks wait for the CPU, memory or I/O (Linux PSI)
Battery S M The charge, charging or how long it lasts, health and cycles
SSD health M L Each NVMe drive's wear, data written, errors and hours on (needs root or CAP_SYS_ADMIN on Linux)
Containers M L XL The Docker or Podman containers running, with their CPU and memory

What it can read

  • Process names and usage on macOS are the worker's own user's (the kernel answers no more without root); on Linux, every process.
  • Container names come from Docker's socket when the worker's user can reach it (the docker group); otherwise a container is its short id.
  • On Linux the NVMe health log and the CPU package's power need root (CAP_SYS_ADMIN, and energy_uj is root's since CVE-2020-8694): without it the snapshot says error: "permission" and there is no power.cpu. macOS reads the NVMe health log without privileges.
  • At start the worker leaves out of Home's widget gallery the widgets this machine cannot fill: battery without a battery, fans without a fan, power without a power figure, gpu without a GPU, containers without cgroup v2 and a container runtime, pressure without a stall figure, ssd without an NVMe drive.
  • system::on-workers asks the engine for its workers (engine::workers::list, engine::workers::info): behind an RBAC proxy those must be allowed for the worker.

Search the registry

Find workers, kits and executables, or jump to a page.