Fix bug when sending certain emails while checking probe readings

use common method to add more context for email template
This commit is contained in:
Lance Edgar 2018-10-25 09:00:17 -05:00
parent ad3e647160
commit 7212b07504

View file

@ -208,13 +208,13 @@ class TempmonServerDaemon(Daemon):
and prev_status in (self.enum.TEMPMON_PROBE_STATUS_CRITICAL_HIGH_TEMP, and prev_status in (self.enum.TEMPMON_PROBE_STATUS_CRITICAL_HIGH_TEMP,
self.enum.TEMPMON_PROBE_STATUS_CRITICAL_TEMP) self.enum.TEMPMON_PROBE_STATUS_CRITICAL_TEMP)
and prev_alert_sent): and prev_alert_sent):
send_email(self.config, 'tempmon_high_temp', data) self.send_email(status, 'tempmon_high_temp', data)
probe.status_alert_sent = self.now probe.status_alert_sent = self.now
return return
# send email when things go back to normal (i.e. from any other status) # send email when things go back to normal (i.e. from any other status)
if status == self.enum.TEMPMON_PROBE_STATUS_GOOD_TEMP and prev_alert_sent: if status == self.enum.TEMPMON_PROBE_STATUS_GOOD_TEMP and prev_alert_sent:
send_email(self.config, 'tempmon_good_temp', data) self.send_email(status, 'tempmon_good_temp', data)
probe.status_alert_sent = self.now probe.status_alert_sent = self.now
return return