Allow disabling repeated alerts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
IamTheFij 2019-06-03 12:15:38 -07:00
parent 05f630d08a
commit edb3bdb44a
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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: