socktop/socktop_agent
2025-08-27 16:00:29 -07:00
..
proto Publish: include proto in each crate and fix build.rs paths 2025-08-22 10:44:56 -07:00
src MACOS / NON LINUX metrics optimizations. 2025-08-27 16:00:29 -07:00
tests test(agent): move inline port parsing test to tests/port_parse.rs 2025-08-24 12:15:32 -07:00
build.rs Publish: include proto in each crate and fix build.rs paths 2025-08-22 10:44:56 -07:00
Cargo.toml MACOS / NON LINUX metrics optimizations. 2025-08-27 16:00:29 -07:00
README.md docs: add per-crate README.md and link via Cargo.toml readme field 2025-08-24 17:56:22 -07:00

socktop_agent (server)

Lightweight ondemand metrics WebSocket server for the socktop TUI.

Highlights:

  • Collects system metrics only when requested (keeps idle CPU <1%)
  • Optional TLS (selfsigned cert autogenerated & pinned by client)
  • JSON for fast metrics / disks; protobuf (optionally gzipped) for processes
  • Accurate perprocess CPU% on Linux via /proc jiffies delta
  • Optional GPU & temperature metrics (disable via env vars)
  • Simple token auth (?token=...) support

Run (no TLS):

cargo install socktop_agent
socktop_agent --port 3000

Enable TLS:

SOCKTOP_ENABLE_SSL=1 socktop_agent --port 8443
# cert/key stored under $XDG_DATA_HOME/socktop_agent/tls

Environment toggles:

  • SOCKTOP_AGENT_GPU=0 (disable GPU collection)
  • SOCKTOP_AGENT_TEMP=0 (disable temperature)
  • SOCKTOP_TOKEN=secret (require token param from client)
  • SOCKTOP_AGENT_METRICS_TTL_MS=250 (cache fast metrics window)
  • SOCKTOP_AGENT_PROCESSES_TTL_MS=1000
  • SOCKTOP_AGENT_DISKS_TTL_MS=1000

Systemd unit example & full docs: https://github.com/jasonwitty/socktop