From e6f3448acc8488f2eae810092534eeca1e0eca84 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 11 Dec 2016 10:46:53 -0600 Subject: [PATCH] Hopefully fix alert logic when status becomes good No need to send alert for good status, if previous status never actually triggered an alert. --- rattail_tempmon/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rattail_tempmon/server.py b/rattail_tempmon/server.py index a5d913c..62a1068 100644 --- a/rattail_tempmon/server.py +++ b/rattail_tempmon/server.py @@ -116,13 +116,14 @@ class TempmonServerDaemon(Daemon): } prev_status = probe.status + prev_alert_sent = probe.status_alert_sent if probe.status != status: probe.status = status probe.status_changed = self.now probe.status_alert_sent = None # send email when things go back to normal, after being bad - if status == self.enum.TEMPMON_PROBE_STATUS_GOOD_TEMP: + if status == self.enum.TEMPMON_PROBE_STATUS_GOOD_TEMP and prev_alert_sent: send_email(self.config, 'tempmon_good_temp', data) probe.status_alert_sent = self.now