refactor monitoring

This commit is contained in:
Son NK 2020-10-11 18:11:49 +02:00
parent 4e45a619cd
commit c2e03854ef

View file

@ -15,6 +15,9 @@ _nb_failed = 0
_max_nb_fails = 10
# the maximum number of emails in incoming & active queue
_max_incoming_active = 50
def get_stats():
"""Look at different metrics and alert appropriately"""
@ -33,8 +36,7 @@ def get_stats():
global _nb_failed
# alert when too many emails in incoming + active queue
# 50 is an arbitrary number here
if incoming_queue + active_queue > 50:
if incoming_queue + active_queue > _max_incoming_active:
_nb_failed += 1
if _nb_failed > _max_nb_fails: