Repository navigation
feat(notify): alert when Btrfs or ZFS usage reaches a configurable threshold - #1133
Merged
Merged
Conversation
…reshold One new setting, metrics.filesystem_usage_threshold_percent (0 disables, 1 to 100), exposed in the dashboard notification settings and validated by POST /api/settings. The Btrfs and ZFS upload paths gain a fourth, least severe failure type (BtrfsUsageHigh, ZFSUsageHigh) that fires when usage reaches the threshold since the previous upload, on first sight, or on every upload while above it with repeat notifications on. Btrfs usage is computed as the dashboard does it: statfs used over used plus available when the collector sent statfs figures, raw used over device size otherwise. ZFS uses the collector's capacity_percent. notifyStateChange now loads settings on every unsilenced upload instead of after a repeat-only pre-check, because the threshold lives in settings. Usage is included in both notification bodies. Closes #1132 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XyPthdH33ZeTJLDutdTt24
… a restart SaveSettings only updates setting_entries rows that already exist, so the new threshold lived in memory until the next restart and then reverted to disabled. A migration now seeds the row at 0, and a sqlite round-trip test saves 80, reloads from a fresh config, and checks it is still 80. Also adds the ZFS "usage at threshold" table case the Btrfs table had. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XyPthdH33ZeTJLDutdTt24
Starosdev
pushed a commit
that referenced
this pull request
Nov 5, 2026
## [1.80.0](v1.79.3...v1.80.0) (2026-11-05) ### Features * **btrfs:** notify on degraded filesystems, device errors and scrub errors ([#1127](#1127)) ([36e1e23](36e1e23)), closes [#1110](#1110) * manual release trigger ([44f3e44](44f3e44)) * **notify:** alert when Btrfs or ZFS usage reaches a configurable threshold ([#1133](#1133)) ([6e79118](6e79118)), closes [#1127](#1127) [#1132](#1132) [#1127](#1127) * **zfs:** notify on unhealthy pools, error totals and scrub errors ([#1131](#1131)) ([9c6544c](9c6544c)), closes [#1127](#1127) [#1130](#1130) [#1127](#1127) ### Bug Fixes * **database:** inline validated ids in Btrfs and ZFS history queries for InfluxDB OSS ([#1111](#1111)) ([#1124](#1124)) ([b0a1c69](b0a1c69)), closes [#157](#157) [#155](#155) [#157](#157) [#157](#157) * **mdadm:** honor repeat notifications and retry failed degraded alerts ([#1128](#1128)) ([62f9cef](62f9cef)), closes [#1109](#1109) * **notify:** notify on manufacturer SMART failures at every notify level ([#1126](#1126)) ([5cb3622](5cb3622))
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
Adds one setting,
metrics.filesystem_usage_threshold_percent(0 disables, 1 to 100), and a usage alert for Btrfs filesystems and ZFS pools on top of the per-upload notification path from #1127 and #1131. This is the optional item from #1110.Type of Change
Related Issues
Closes #1132
Changes Made
models/settings.go:FilesystemUsageThresholdPercentundermetrics;MaxFilesystemUsageThresholdPercent = 100. Zero is the disabled sentinel, so no default is needed and existing installs are unchanged.handler/save_settings.go: rejects values outside 0..100 with a 400.notify/btrfs.go,notify/zfs.go: new least-severe failure typesBtrfsUsageHighandZFSUsageHigh.BtrfsUsagePercentmirrors the dashboard formula (statfs_used / (statfs_used + statfs_available), falling back toused / device_size); ZFS usescapacity_percent. SharedusageCrossedfires at or above the threshold when newly crossed, first seen, or repeating. Both messages now carry aUsageline.handler/state_notify.go: settings load on every unsilenced upload (the threshold lives there) instead of after a repeat-only pre-check. Muted and archived rows still return before the load.failureTypestakes the threshold.filesystem_usage_threshold_percentinapp.config.ts; number input with validation in the dashboard settings dialog under the temperature settings; Save disabled while invalid via the newnotificationSettingsInvalidgetter.openapi.yamlsettings schema.Testing
go test ./webapp/backend/pkg/web/handler/ ./webapp/backend/pkg/models/ -count=1ok;go test ./webapp/backend/pkg/notify/ -run 'Btrfs|ZFS'ok.notify: 7 new Btrfs and 5 new ZFS usage cases in the failure-type tables (cross, at threshold, stays above with and without repeat, first upload, below, disabled), plusTestBtrfsUsagePercent. Full notify package still has the macOS-onlyTestScriptStreamsOutputAndPreservesEnvironmentfailure noted in feat(btrfs): notify on degraded filesystems, device errors and scrub errors #1127; unrelated.handler:TestSaveSettingsFilesystemUsageThresholdValidation(0, 1, 100 accepted; -1, 101 rejected). Healthy-upload tests now return settings and assertGetNotifyUrlsis never called.node_moduleshere); relies on theTest FrontendCI job.go build ./webapp/backend/...,go vetandgofmt -lclean on the touched packages.Review: not required (lands on
develop; reaches users through the promotion PR and release).Checklist
Screenshots (if applicable)
N/A
Additional Notes
Cost: one extra
LoadSettings(asetting_entriestable read) per Btrfs or ZFS upload, so once per collector interval per filesystem or pool.