Add per-status timeouts and tracking for probe status

i.e. this lets us keep track of when a probe becomes "high temp" and then later
if it becomes "critical high temp" we can still know how long it's been high
This commit is contained in:
Lance Edgar 2018-10-19 14:58:30 -05:00
parent 8be64c0580
commit 19553edda6
6 changed files with 324 additions and 41 deletions
rattail_tempmon

View file

@ -54,6 +54,30 @@ class TempmonBase(object):
}
class tempmon_critical_high_temp(TempmonBase, Email):
"""
Sent when a tempmon probe takes a "critical high" temperature reading.
"""
default_subject = "CRITICAL HIGH Temperature"
def sample_data(self, request):
data = super(tempmon_critical_high_temp, self).sample_data(request)
data['status'] = self.enum.TEMPMON_PROBE_STATUS[self.enum.TEMPMON_PROBE_STATUS_CRITICAL_HIGH_TEMP]
return data
class tempmon_critical_low_temp(TempmonBase, Email):
"""
Sent when a tempmon probe takes a "critical low" temperature reading.
"""
default_subject = "CRITICAL LOW Temperature"
def sample_data(self, request):
data = super(tempmon_critical_low_temp, self).sample_data(request)
data['status'] = self.enum.TEMPMON_PROBE_STATUS[self.enum.TEMPMON_PROBE_STATUS_CRITICAL_LOW_TEMP]
return data
class tempmon_critical_temp(TempmonBase, Email):
"""
Sent when a tempmon probe takes a reading which is "critical" in either the
@ -92,7 +116,7 @@ class tempmon_good_temp(TempmonBase, Email):
Sent whenever a tempmon probe first takes a "good temp" reading, after
having previously had some bad reading(s).
"""
default_subject = "Good temperature detected"
default_subject = "OK Temperature"
def sample_data(self, request):
data = super(tempmon_good_temp, self).sample_data(request)
@ -105,7 +129,7 @@ class tempmon_high_temp(TempmonBase, Email):
Sent when a tempmon probe takes a reading which is above the "maximum good
temp" range, but still below the "critically high temp" threshold.
"""
default_subject = "High temperature detected"
default_subject = "HIGH Temperature"
def sample_data(self, request):
data = super(tempmon_high_temp, self).sample_data(request)
@ -118,7 +142,7 @@ class tempmon_low_temp(TempmonBase, Email):
Sent when a tempmon probe takes a reading which is below the "minimum good
temp" range, but still above the "critically low temp" threshold.
"""
default_subject = "Low temperature detected"
default_subject = "LOW Temperature"
def sample_data(self, request):
data = super(tempmon_low_temp, self).sample_data(request)