Browse Source

Allow disabling repeated alerts

starlark-build
IamTheFij 2 years ago
parent
commit
edb3bdb44a
  1. 4
      minitor/main.py
  2. 4
      sample-config.yml

4
minitor/main.py

@ -61,7 +61,6 @@ def validate_monitor_settings(settings):
non_zero = (
'check_interval',
'alert_after',
'alert_every',
)
for key in non_zero:
@ -220,6 +219,9 @@ class Monitor(object):
if self.alert_every > 0:
# Otherwise, we should check against our alert_every
should_alert = (failure_count % self.alert_every) == 0
elif self.alert_every == 0:
# Only alert on the first failure
should_alert = failure_count == 1
else:
should_alert = (failure_count >= (2 ** self.alert_count) - 1)

4
sample-config.yml

@ -5,9 +5,9 @@ monitors:
command: [ 'curl', '-s', '-o', '/dev/null', 'https://minitor.mon' ]
alert_down: [ log, mailgun_down, sms_down ]
alert_up: [ log, email_up ]
check_interval: 30
check_interval: 30 # Must be at minimum the global `check_interval`
alert_after: 3
alert_every: -1 # Defaults to -1 for exponential backoff
alert_every: -1 # Defaults to -1 for exponential backoff. 0 to disable repeating
alerts:
email_up:

Loading…
Cancel
Save