kyleandClaude Fable 5.1 2e3f28bc30 Rewrite the logger in Rust; add install targets
vitals-log replaces the bash sampler and writes the same CSV layout.
The crate is now a library plus two binaries. dist/ holds the systemd
unit and desktop entry templates, installed by make install.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-19 23:46:09 -07:00
2026-09-19 23:40:38 -07:00
2026-09-19 23:40:38 -07:00
2026-09-19 23:40:38 -07:00

vitals

Logs system temperatures, power status and memory load once a minute, and plots the history.

  • vitals-log takes one sample and appends it to vitals-YYYY-MM.csv. A systemd user timer runs it every minute.
  • vitals is the viewer: the latest reading plus time-series plots, built with egui and egui_plot.

Install

make install

This builds both binaries into ~/.local/bin, installs and starts vitals-log.timer (systemd user unit), and installs the Vitals desktop entry so the viewer shows up in the launcher. PREFIX=/somewhere make install changes where the binaries go; the unit and desktop entry are generated from the templates in dist/ to point at them. The pieces can be installed separately with make install-bin, install-units and install-desktop.

make uninstall removes all of it and leaves the logs alone. For logging to continue while logged out, enable lingering once: loginctl enable-linger.

Logger

vitals-log [--dir PATH] [--print]

Logs go to $XDG_STATE_HOME/vitals (~/.local/state/vitals), one file per month, about 5 MB each. --print writes the header and a sample to stdout without touching the log, which is the quick way to check what a machine exposes.

The columns are fixed and defined in src/sample.rs: temperatures come from hwmon chips looked up by name (the hwmonN numbering changes between boots), power from /sys/class/power_supply and powerprofilesctl, memory from /proc/meminfo and /proc/pressure/memory. The sensor table is specific to this laptop (Framework, Intel); on other hardware, edit TEMPERATURES. A source that can't be read leaves an empty cell. If the column set changes mid-month, the old file is renamed vitals-YYYY-MM.until-<timestamp>.csv so layouts never mix in one file.

Viewer

vitals [--dir PATH] [--interval SECONDS] [--range 1h|6h|24h|7d|all]

Every vitals-YYYY-MM.csv is loaded at startup; after that only bytes appended since the last check are read (every 10 s by default). Columns are matched by header name, so a changed log layout shows gaps rather than breaking.

Drag to pan and ctrl-scroll or pinch to zoom the time axis; all plots move together. Picking a range preset returns to following the clock. Lines break where the logger was not running, and on-battery periods are shaded in the battery plot. Wide ranges are reduced to per-bucket min/max, so spikes stay visible.

Source

  • src/sample.rs — reading sensors, appending to the log
  • src/data.rs — parsed series, windowing, gap splitting, downsampling
  • src/tail.rs — incremental file reader, month rollover, replaced-file reload
  • src/bin/vitals-log.rs — the logger's command line
  • src/bin/vitals.rs — the viewer; the PANELS table defines the plots
  • dist/ — systemd unit and desktop entry templates
S
Description
No description provided
Readme
83 KiB
Languages
Rust 97.4%
Makefile 2.6%