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 flagArgumentsDescription
--helpnonePrint 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..60000Sampling period in milliseconds (default 1000 ms). Values outside 100..60000 exit with code 2.
--cap-mb (server)>= 1Memory 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)>= 0Request integer identifier placed in the JSON request and matched in the response (default 1).
--interval (client)> 0Sampling 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

MethodRequest params objectResponse result fields
statusnoneprotocol ("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).
nownoneunix_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).
stopnone{"stopping": true}, after which the server flushes stdout, stops the background monitor thread, and exits 0.

Metric catalog (24 metrics)

Metric pathGroupKind / unitDescription
cpu.usage_pctcpurate / pctHost-normalized total busy CPU percentage across all cores (100 - idle, range 0..100).
cpu.user_pctcpurate / pctHost-normalized user-mode (including nice) CPU percentage (0..100).
cpu.system_pctcpurate / pctHost-normalized kernel/system CPU percentage, including IRQ, softirq, and steal ticks (0..100).
cpu.iowait_pctcpurate / pctHost-normalized I/O wait CPU percentage (0..100; 0 on Windows).
cpu.max_core_busy_pctcpurate / pctBusy percentage of the single most loaded logical CPU core over the tick interval (0..100).
cpu.psi_some_avg10cpugauge / pctLinux /proc/pressure/cpu some avg10 stall percentage (-1 on macOS and Windows).
mem.used_pctmemgauge / pctPercentage of physical RAM in use: 100 * (total - available) / total (0..100).
mem.available_bytesmemgauge / bytesEstimated bytes of physical memory available for starting new applications without swapping.
mem.swap_used_pctmemgauge / pctPercentage of configured swap space currently used (0..100, or -1 when no swap is configured).
mem.psi_some_avg10memgauge / pctLinux /proc/pressure/memory some avg10 stall percentage (-1 on macOS and Windows).
disk.read_bytes_ratediskrate / bytes/sAggregate bytes read per second across all eligible non-stacked physical block devices.
disk.write_bytes_ratediskrate / bytes/sAggregate bytes written per second across all eligible non-stacked physical block devices.
disk.read_ops_ratediskrate / 1/sAggregate read I/O operations completed per second across eligible physical disks.
disk.write_ops_ratediskrate / 1/sAggregate write I/O operations completed per second across eligible physical disks.
disk.max_util_pctdiskrate / pctBusy time percentage of the single most utilized physical disk over the tick interval (0..100; -1 on macOS).
disk.psi_some_avg10diskgauge / pctLinux /proc/pressure/io some avg10 stall percentage (-1 on macOS and Windows).
net.rx_bytes_ratenetrate / bytes/sAggregate bytes received per second across all non-loopback network interfaces.
net.tx_bytes_ratenetrate / bytes/sAggregate bytes transmitted per second across all non-loopback network interfaces.
net.rx_packets_ratenetrate / 1/sAggregate packets received per second across all non-loopback network interfaces.
net.tx_packets_ratenetrate / 1/sAggregate packets transmitted per second across all non-loopback network interfaces.
net.rx_errors_ratenetrate / 1/sAggregate receive error count per second across all non-loopback network interfaces.
net.tx_errors_ratenetrate / 1/sAggregate transmit error count per second across all non-loopback network interfaces.
net.rx_dropped_ratenetrate / 1/sAggregate inbound dropped packets per second across all non-loopback network interfaces.
net.tx_dropped_ratenetrate / 1/sAggregate outbound dropped packets per second across all non-loopback network interfaces.

Exit codes

Exit codeComponentMeaning
0server / clientClean shutdown on stop request, stdin EOF, SIGINT/SIGTERM, --help, or successful client query response.
1server / clientRuntime error: client failed to spawn server, open/write FIFOs, or receive a matching response id within the timeout.
2server / clientCommand-line usage error: unknown flag, --interval outside 100..60000 ms, --cap-mb < 1, mismatched --in/--out, or invalid params JSON.
4serverStdout stream write error while emitting a JSON response line.