mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
nagios: use last Received date to determine message age.
If there are delays while routing the email, we don't want to get a spurious alert. (imported from commit 3a9e3abf0a4db2b026f797c929f1b46978f1e5e4)
This commit is contained in:
@@ -35,7 +35,8 @@ def check_for_old_messages(result):
|
|||||||
message_uids.sort()
|
message_uids.sort()
|
||||||
|
|
||||||
oldest_message = email.message_from_string(result[message_uids[0]]["RFC822"])
|
oldest_message = email.message_from_string(result[message_uids[0]]["RFC822"])
|
||||||
receipt_time = time.mktime(email.utils.parsedate_tz(oldest_message.get("Date")))
|
last_received_string = oldest_message.get_all("Received")[0].split(";", 1)[-1].strip()
|
||||||
|
receipt_time = email.utils.mktime_tz(email.utils.parsedate_tz(last_received_string))
|
||||||
if time.time() - receipt_time > 60 * 5: # More than 5 minutes old.
|
if time.time() - receipt_time > 60 * 5: # More than 5 minutes old.
|
||||||
return 2, "CRITICAL: email mirror has unprocessed old messages."
|
return 2, "CRITICAL: email mirror has unprocessed old messages."
|
||||||
return 0, "OK: no unprocessed old messages."
|
return 0, "OK: no unprocessed old messages."
|
||||||
|
|||||||
Reference in New Issue
Block a user