Add problem report for disabled clients/probes
This commit is contained in:
parent
840c146969
commit
fd7cd5cadd
5 changed files with 122 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8; -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
|
@ -30,8 +30,10 @@ from rattail.db import model
|
|||
from rattail.mail import Email
|
||||
from rattail.time import localtime
|
||||
|
||||
from rattail_tempmon.db import model as tempmon
|
||||
|
||||
class tempmon(object):
|
||||
|
||||
class TempmonBase(object):
|
||||
"""
|
||||
Generic base class for all tempmon-related emails; adds common sample data.
|
||||
"""
|
||||
|
@ -50,7 +52,7 @@ class tempmon(object):
|
|||
}
|
||||
|
||||
|
||||
class tempmon_critical_temp(tempmon, Email):
|
||||
class tempmon_critical_temp(TempmonBase, Email):
|
||||
"""
|
||||
Sent when a tempmon probe takes a reading which is "critical" in either the
|
||||
high or low sense.
|
||||
|
@ -63,7 +65,7 @@ class tempmon_critical_temp(tempmon, Email):
|
|||
return data
|
||||
|
||||
|
||||
class tempmon_error(tempmon, Email):
|
||||
class tempmon_error(TempmonBase, Email):
|
||||
"""
|
||||
Sent when a tempmon probe is noticed to have some error, i.e. no current readings.
|
||||
"""
|
||||
|
@ -76,7 +78,7 @@ class tempmon_error(tempmon, Email):
|
|||
return data
|
||||
|
||||
|
||||
class tempmon_good_temp(tempmon, Email):
|
||||
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).
|
||||
|
@ -89,7 +91,7 @@ class tempmon_good_temp(tempmon, Email):
|
|||
return data
|
||||
|
||||
|
||||
class tempmon_high_temp(tempmon, Email):
|
||||
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.
|
||||
|
@ -102,7 +104,7 @@ class tempmon_high_temp(tempmon, Email):
|
|||
return data
|
||||
|
||||
|
||||
class tempmon_low_temp(tempmon, Email):
|
||||
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.
|
||||
|
@ -113,3 +115,20 @@ class tempmon_low_temp(tempmon, Email):
|
|||
data = super(tempmon_low_temp, self).sample_data(request)
|
||||
data['status'] = self.enum.TEMPMON_PROBE_STATUS[self.enum.TEMPMON_PROBE_STATUS_LOW_TEMP]
|
||||
return data
|
||||
|
||||
|
||||
class tempmon_disabled_probes(Email):
|
||||
"""
|
||||
Notifies of any Tempmon client devices or probes which are disabled.
|
||||
"""
|
||||
default_subject = "Disabled probes"
|
||||
|
||||
def sample_data(self, request):
|
||||
return {
|
||||
'disabled_clients': [
|
||||
tempmon.Client(config_key='foo', hostname='foo.example.com'),
|
||||
],
|
||||
'disabled_probes': [
|
||||
tempmon.Probe(description="north wall of walk-in cooler"),
|
||||
],
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue