Show memory and disk capacity on dashboard tiles #20

Merged
jhodgkin merged 2 commits from feature/tile-capacity into main 2026-07-23 10:37:16 -06:00
Owner

Adds used/total capacity (e.g. "19.6/32.0 GB") under the Mem/Disk bars on each host card, in addition to the existing percentage.

Changes:

  • MetricSnapshot gains memTotalBytes/memUsedBytes/diskTotalBytes/diskUsedBytes
  • ProxmoxCollector and SshHostCollector populate them from data they already fetch
  • metric_snapshots table gets 4 new columns, with a migration for the already-deployed CT122 DB (same pattern as the existing mdns_hostname/is_bootstrap migrations)
  • /api/hosts and the web HostSummary type pass the new fields through
  • HostCard renders a new muted capacity line under the bars, styled like the existing pressure-row

Verified: ran a throwaway local instance (temp SQLite DB, seeded a synthetic host/snapshot, logged in via the local admin account, screenshotted the rendered tile) to confirm the end-to-end render, not just the typecheck.

Caveat: for the two SSH-collected hosts (omv, ripper), this assumes the remote monitor-readonly.sh script's MEMLINE/DISK_ fields are raw bytes, matching Proxmox's convention. Couldn't verify directly -- that script only lives on those two hosts, not in this repo. Worth a quick visual sanity check on those two cards once deployed.

Adds used/total capacity (e.g. "19.6/32.0 GB") under the Mem/Disk bars on each host card, in addition to the existing percentage. **Changes:** - `MetricSnapshot` gains `memTotalBytes`/`memUsedBytes`/`diskTotalBytes`/`diskUsedBytes` - `ProxmoxCollector` and `SshHostCollector` populate them from data they already fetch - `metric_snapshots` table gets 4 new columns, with a migration for the already-deployed CT122 DB (same pattern as the existing `mdns_hostname`/`is_bootstrap` migrations) - `/api/hosts` and the web `HostSummary` type pass the new fields through - `HostCard` renders a new muted capacity line under the bars, styled like the existing pressure-row **Verified:** ran a throwaway local instance (temp SQLite DB, seeded a synthetic host/snapshot, logged in via the local admin account, screenshotted the rendered tile) to confirm the end-to-end render, not just the typecheck. **Caveat:** for the two SSH-collected hosts (omv, ripper), this assumes the remote `monitor-readonly.sh` script's `MEMLINE`/`DISK_` fields are raw bytes, matching Proxmox's convention. Couldn't verify directly -- that script only lives on those two hosts, not in this repo. Worth a quick visual sanity check on those two cards once deployed.
jhodgkin added 1 commit 2026-07-22 17:36:18 -06:00
Show memory and disk capacity (used/total) on dashboard tiles
CI / web (pull_request) Successful in 24s
CI / api (pull_request) Successful in 31s
5329136bad
Previously the Mem/Disk bars only showed a percentage. Plumbed the
underlying byte totals through the whole stack -- collectors, DB
(with a migration for the already-deployed CT122 instance), API, and
the web tile -- so each card also shows e.g. "19.6/32.0 GB".

Verified end-to-end with a throwaway local instance (seeded snapshot,
logged in, screenshotted the rendered tile).

Note: the SSH-collected hosts (omv, ripper) assume the remote
monitor-readonly.sh script emits raw bytes for MEMLINE/DISK_, matching
Proxmox's convention -- unverified since that script only lives on
those two hosts, not in this repo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jhodgkin added 1 commit 2026-07-22 17:40:30 -06:00
Guard formatCapacity against NaN/negative/used>total and a rounding edge case
CI / web (pull_request) Successful in 19s
CI / api (pull_request) Successful in 25s
e72d403a30
Adversarial review of PR #20 flagged two narrow edge cases: malformed
remote-script output could produce NaN and render literally, and a
used>total race could show e.g. "510/500 GB". Also fixed a cosmetic
rounding bug where a value like 99.96 took the one-decimal branch and
toFixed(1) rounded it up to "100.0" instead of "100".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jhodgkin merged commit c30363449e into main 2026-07-23 10:37:16 -06:00
jhodgkin deleted branch feature/tile-capacity 2026-07-23 10:37:16 -06:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jhodgkin/homelab-monitor#20