Hopefully fix alert logic when status becomes good

No need to send alert for good status, if previous status never actually
triggered an alert.
This commit is contained in:
Lance Edgar 2016-12-11 10:46:53 -06:00
parent de1543018a
commit e6f3448acc

View file

@ -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