Skip to content

Commit

Permalink
Merge branch 'task/es_writeback_sleep_time' into 'master'
Browse files Browse the repository at this point in the history
Writeback ES sleep time

See merge request opensolutions/elastalert!7
  • Loading branch information
NSDDataDope committed Dec 12, 2019
2 parents f887dc5 + 29f9a24 commit 8830932
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions elastalert/elastalert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,14 @@ def start(self):

# Wait before querying again
sleep_duration = total_seconds(next_run - datetime.datetime.utcnow())

# Write to ES info about the round of rules executed
body = {'@timestamp': ts_now(),
'total_rules': [rule['name'] for rule in self.rules],
'disabled_rules': [rule['name'] for rule in self.disabled_rules],
'sleep_duration': sleep_duration}
self.writeback('elastalert_control', body)

self.sleep_for(sleep_duration)

def wait_until_responsive(self, timeout, clock=timeit.default_timer):
Expand Down

0 comments on commit 8830932

Please sign in to comment.