alarms: reduce state changes that trigger notifications
This commit is contained in:
parent
ac5a604587
commit
1b8a64725f
1 changed files with 5 additions and 1 deletions
|
@ -39,7 +39,11 @@ class Alarm(db.Model): # type: ignore
|
|||
activity = Activity(activity_type="alarm_state",
|
||||
text=f"{self.alarm_state.name}->{state.name}! State changed for "
|
||||
f"{self.aspect} on {self.target}: {text}")
|
||||
activity.notify()
|
||||
if (self.alarm_state.name in ["WARNING", "CRITICAL"]
|
||||
or state.name in ["WARNING", "CRITICAL", "UNKNOWN"]):
|
||||
# Notifications are only sent on recovery from warning/critical state or on entry
|
||||
# to warning/critical/unknown states. This should reduce alert fatigue.
|
||||
activity.notify()
|
||||
db.session.add(activity)
|
||||
self.alarm_state = state
|
||||
self.text = text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue