Skip to content

Add memory warn/crit thresholds and evaluate them in the alert engine#81

Merged
LarsLaskowski merged 2 commits into
mainfrom
claude/issue-61-5woti6
Jul 17, 2026
Merged

Add memory warn/crit thresholds and evaluate them in the alert engine#81
LarsLaskowski merged 2 commits into
mainfrom
claude/issue-61-5woti6

Conversation

@LarsLaskowski

@LarsLaskowski LarsLaskowski commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add memory_warn_percent/memory_crit_percent to config.Thresholds (config file, defaults, and validation), mirrored in httpapi.Thresholds exposed via GET /api/v1/config.
  • Feed memory into alert.Sample/Engine.Evaluate as a new memory state metric, wired from the collector's existing memory reading.
  • Point the dashboard's RAM bar (renderBar('mem-bar', ...)) at the new memory_warn_percent/memory_crit_percent pair instead of the disk thresholds it was coincidentally using.
  • Update docs/API.md and packaging/pimonitor.example.yaml accordingly.

Previously a box sitting at 99% RAM used never fired an alert (CPU, swap, disk, and temperature all did), and the dashboard's RAM coloring only happened to look right because both disk and memory defaulted to 80/95.

Default values (80/95) match the previous coincidental disk-threshold behavior, so existing installs see no default-config UI change; they now just have an independently configurable pair, and the alert engine evaluates it.

This is additive to the API surface (new memory entry in /api/v1/alerts states, new fields in /api/v1/config), not a breaking change to /api/v1/... response shapes.

Related Issue

Closes #61

Checklist

  • Tests added/updated for the change (go test ./... passes locally)
  • go vet ./... and golangci-lint run are clean
  • Documentation updated if this changes the REST API (docs/API.md),
    configuration (README.md, packaging/pimonitor.example.yaml), or
    installation/packaging (packaging/install.sh, systemd units)
  • No breaking change to /api/v1/... response shapes, or a new API
    version was introduced instead

claude and others added 2 commits July 17, 2026 15:52
The dashboard colored the RAM bar using the disk thresholds
(coincidentally, since both defaulted to 80/95), and config.Thresholds
had no memory pair at all, so the alert engine never evaluated memory -
a box sitting at 99% RAM used never fired an alert while CPU, swap,
disk, and temperature all did.

Add memory_warn_percent/memory_crit_percent to config.Thresholds (and
the mirrored httpapi.Thresholds exposed via GET /api/v1/config), feed
memory into alert.Sample/Engine.Evaluate as a new "memory" state
metric, and point the dashboard's RAM bar at the new pair instead of
the disk one. This is additive to the API surface, not a breaking
change to /api/v1/*.

Closes #61
@LarsLaskowski
LarsLaskowski merged commit dc14f8b into main Jul 17, 2026
3 checks passed
@LarsLaskowski
LarsLaskowski deleted the claude/issue-61-5woti6 branch July 17, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory has no thresholds: UI colors RAM with the disk thresholds, alert engine never evaluates memory

2 participants