Add memory warn/crit thresholds and evaluate them in the alert engine#81
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memory_warn_percent/memory_crit_percenttoconfig.Thresholds(config file, defaults, and validation), mirrored inhttpapi.Thresholdsexposed viaGET /api/v1/config.alert.Sample/Engine.Evaluateas a newmemorystate metric, wired from the collector's existing memory reading.renderBar('mem-bar', ...)) at the newmemory_warn_percent/memory_crit_percentpair instead of the disk thresholds it was coincidentally using.docs/API.mdandpackaging/pimonitor.example.yamlaccordingly.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
memoryentry in/api/v1/alertsstates, new fields in/api/v1/config), not a breaking change to/api/v1/...response shapes.Related Issue
Closes #61
Checklist
go test ./...passes locally)go vet ./...andgolangci-lint runare cleandocs/API.md),configuration (
README.md,packaging/pimonitor.example.yaml), orinstallation/packaging (
packaging/install.sh, systemd units)/api/v1/...response shapes, or a new APIversion was introduced instead