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>
2.8 KiB
vitals
Logs system temperatures, power status and memory load once a minute, and plots the history.
vitals-logtakes one sample and appends it tovitals-YYYY-MM.csv. A systemd user timer runs it every minute.vitalsis 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 logsrc/data.rs— parsed series, windowing, gap splitting, downsamplingsrc/tail.rs— incremental file reader, month rollover, replaced-file reloadsrc/bin/vitals-log.rs— the logger's command linesrc/bin/vitals.rs— the viewer; thePANELStable defines the plotsdist/— systemd unit and desktop entry templates