status alerts grace period 10 mins

This commit is contained in:
2026-09-10 20:46:31 +02:00
parent c23350400c
commit d74634331c
3 changed files with 139 additions and 10 deletions
+7 -1
View File
@@ -825,7 +825,7 @@ full-size PNG when a graph is clicked.
The collector also sends an ntfy notification when:
- The UPS status changes
- The UPS status changes and the new status persists for 10 minutes
- Mean battery charge over the last 10 measurements crosses below 50%
- Mean battery charge over the last 10 measurements crosses below 5%
- Estimated battery runtime crosses below 5 minutes
@@ -835,6 +835,12 @@ Alert state is stored in `/var/lib/rrd/bx950mi-alert-state.json`, allowing
changes to be detected across cron runs. The first run establishes a baseline
without sending notifications. Threshold notifications can fire again after a
value recovers above the threshold and later drops below it.
Status alerts wait until the new status has persisted for 10 minutes. Returning
to the last confirmed status cancels the pending alert, so brief flip-flops
produce no status notifications. A different pending status restarts the timer.
Pending changes are saved across cron runs; alerts are sent on the first run
at or after the 10-minute mark. This delay applies only to status notifications:
battery/runtime alerts and automatic shutdowns still use the current readings.
Battery-charge alerts start after 10 valid measurements have been collected;
using their rolling mean prevents a single erroneous `0%` report from causing
a false alarm. Raw measurements are still stored in the RRD and graphed.