Commit 04b27b1a authored by Jonathan Michalon's avatar Jonathan Michalon

New feature: different check interval for checks in error

parent 1e92bc1f
......@@ -47,6 +47,8 @@ Each check may be initialised with some options:
In addition some checks have specific options, see lib/checks.py for examples.
In case you want to check lesser important services and configure very long check intervals, you may
want to have another interval, global to all checks, for error retries. This can be set with the `error_every` option.
Current state output
--------------------
......
......@@ -12,6 +12,9 @@ config.install_attr('checks', Checks())
# Each check may then individually be configured to run every N * tick
config.install_attr('base_tick', 60)
# How often we retry checks that are in error (-1 disables feature)
config.install_attr('error_every', -1)
# Email addresses to send to when an alert is triggered
config.install_attr('emails.to', [])
# The From: address
......
......@@ -55,7 +55,11 @@ class Check(object):
pass
def run(self, immediate=False):
self.every_count = (self.every_count + 1) % self.every
from . import config
self.every_count = (self.every_count + 1) % (
self.every if self.ok or
config.error_every < 0
else config.error_every)
if self.every_count == 0 or immediate:
self.setup()
if not self.check():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment