lmtop reference
Complete command-line flag reference, stdio NDJSON protocol methods, 24-metric catalog across CPU, memory, disk, and network groups, platform backend matrix, and exit codes for lmtop (protocol lmtop/1).
Server and client CLI flags
| Command or flag | Arguments | Description |
|---|---|---|
| --help | none | Print usage summary for lmtop server and lmtop client to stdout and exit 0. |
| lmtop [server] | [--interval MS] [--cap-mb N] | Run the stdio NDJSON monitor server (default command when no subcommand is given). |
| --interval (server) | 100..60000 | Sampling period in milliseconds (default 1000 ms). Values outside 100..60000 exit with code 2. |
| --cap-mb (server) | >= 1 | Memory budget in MiB for the in-memory sample history ring buffer (default 100 MiB). |
| lmtop client | [options] <method> [params-json] | Query a newly spawned private server (default) or a running server via POSIX FIFOs. |
| --id (client) | >= 0 | Request integer identifier placed in the JSON request and matched in the response (default 1). |
| --interval (client) | > 0 | Sampling interval in milliseconds passed to the spawned child server in one-shot mode (default 1000 ms). |
| --in / --out (client) | <fifo-path> | POSIX only: write the request to the --in FIFO and read the matching response from the --out FIFO (must be specified together). |
Stdio NDJSON protocol methods
| Method | Request params object | Response result fields |
|---|---|---|
| status | none | protocol ("lmtop/1"), pid, hostname, platform, supported, uptime_ms, started_unix_ms, interval_ms, samples_kept, missed_ticks, cpu_count, sample_bytes, memory_bytes_used, memory_bytes_cap, metrics (array of 24 {path, unit, kind, group} objects). |
| now | none | unix_ms, dt_s, cpu_count, group_status ({cpu, mem, disk, net} set to "ok" or reader error string), values (object mapping all 24 metric paths to numeric values or -1). |
| history | {"seconds": int, "max_points": int} (both optional; 0 = all) | columns (["unix_ms", "dt_s", ...24 metric paths]), stride (downsampling step >= 1), total_rows (samples in window before downsampling), rows (array of value arrays; newest sample always included). |
| summary | {"seconds": int} (optional; 0 = all) | window_seconds, samples, started_unix_ms, ended_unix_ms, metrics (array of 24 objects with name, unit, kind, n, min, mean, median, p95, p99, max, stddev, first, last, error). |
| stop | none | {"stopping": true}, after which the server flushes stdout, stops the background monitor thread, and exits 0. |
Metric catalog (24 metrics)
| Metric path | Group | Kind / unit | Description |
|---|---|---|---|
| cpu.usage_pct | cpu | rate / pct | Host-normalized total busy CPU percentage across all cores (100 - idle, range 0..100). |
| cpu.user_pct | cpu | rate / pct | Host-normalized user-mode (including nice) CPU percentage (0..100). |
| cpu.system_pct | cpu | rate / pct | Host-normalized kernel/system CPU percentage, including IRQ, softirq, and steal ticks (0..100). |
| cpu.iowait_pct | cpu | rate / pct | Host-normalized I/O wait CPU percentage (0..100; 0 on Windows). |
| cpu.max_core_busy_pct | cpu | rate / pct | Busy percentage of the single most loaded logical CPU core over the tick interval (0..100). |
| cpu.psi_some_avg10 | cpu | gauge / pct | Linux /proc/pressure/cpu some avg10 stall percentage (-1 on macOS and Windows). |
| mem.used_pct | mem | gauge / pct | Percentage of physical RAM in use: 100 * (total - available) / total (0..100). |
| mem.available_bytes | mem | gauge / bytes | Estimated bytes of physical memory available for starting new applications without swapping. |
| mem.swap_used_pct | mem | gauge / pct | Percentage of configured swap space currently used (0..100, or -1 when no swap is configured). |
| mem.psi_some_avg10 | mem | gauge / pct | Linux /proc/pressure/memory some avg10 stall percentage (-1 on macOS and Windows). |
| disk.read_bytes_rate | disk | rate / bytes/s | Aggregate bytes read per second across all eligible non-stacked physical block devices. |
| disk.write_bytes_rate | disk | rate / bytes/s | Aggregate bytes written per second across all eligible non-stacked physical block devices. |
| disk.read_ops_rate | disk | rate / 1/s | Aggregate read I/O operations completed per second across eligible physical disks. |
| disk.write_ops_rate | disk | rate / 1/s | Aggregate write I/O operations completed per second across eligible physical disks. |
| disk.max_util_pct | disk | rate / pct | Busy time percentage of the single most utilized physical disk over the tick interval (0..100; -1 on macOS). |
| disk.psi_some_avg10 | disk | gauge / pct | Linux /proc/pressure/io some avg10 stall percentage (-1 on macOS and Windows). |
| net.rx_bytes_rate | net | rate / bytes/s | Aggregate bytes received per second across all non-loopback network interfaces. |
| net.tx_bytes_rate | net | rate / bytes/s | Aggregate bytes transmitted per second across all non-loopback network interfaces. |
| net.rx_packets_rate | net | rate / 1/s | Aggregate packets received per second across all non-loopback network interfaces. |
| net.tx_packets_rate | net | rate / 1/s | Aggregate packets transmitted per second across all non-loopback network interfaces. |
| net.rx_errors_rate | net | rate / 1/s | Aggregate receive error count per second across all non-loopback network interfaces. |
| net.tx_errors_rate | net | rate / 1/s | Aggregate transmit error count per second across all non-loopback network interfaces. |
| net.rx_dropped_rate | net | rate / 1/s | Aggregate inbound dropped packets per second across all non-loopback network interfaces. |
| net.tx_dropped_rate | net | rate / 1/s | Aggregate outbound dropped packets per second across all non-loopback network interfaces. |
Exit codes
| Exit code | Component | Meaning |
|---|---|---|
| 0 | server / client | Clean shutdown on stop request, stdin EOF, SIGINT/SIGTERM, --help, or successful client query response. |
| 1 | server / client | Runtime error: client failed to spawn server, open/write FIFOs, or receive a matching response id within the timeout. |
| 2 | server / client | Command-line usage error: unknown flag, --interval outside 100..60000 ms, --cap-mb < 1, mismatched --in/--out, or invalid params JSON. |
| 4 | server | Stdout stream write error while emitting a JSON response line. |