Modify tempmon server logic to take "unfair" time windows into account
when a client or probe first are (re-)enabled, we can't expect to have readings within the time window we'd normally be checking. previously we'd get false alarms about "probe error status" etc. when this happened; hopefully no longer!
This commit is contained in:
parent
f31a0c4c22
commit
cf27af81d4
|
@ -122,10 +122,24 @@ class TempmonServerDaemon(Daemon):
|
||||||
# the client to be (possibly) offline.
|
# the client to be (possibly) offline.
|
||||||
delay = client.delay or 60
|
delay = client.delay or 60
|
||||||
cutoff = self.now - datetime.timedelta(seconds=delay + 60)
|
cutoff = self.now - datetime.timedelta(seconds=delay + 60)
|
||||||
|
|
||||||
|
# but if client was "just now" enabled, cutoff may not be quite fair.
|
||||||
|
# in this case we'll just skip checks until cutoff does seem fair.
|
||||||
|
if cutoff < client.enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
# we make similar checks for each probe; if cutoff "is not fair" for
|
||||||
|
# any of them, we'll skip that probe check, and avoid marking client
|
||||||
|
# offline for this round, just to be safe
|
||||||
online = False
|
online = False
|
||||||
|
cutoff_unfair = False
|
||||||
for probe in client.enabled_probes():
|
for probe in client.enabled_probes():
|
||||||
if self.check_readings_for_probe(session, probe, cutoff):
|
if cutoff < probe.enabled:
|
||||||
|
cutoff_unfair = True
|
||||||
|
elif self.check_readings_for_probe(session, probe, cutoff):
|
||||||
online = True
|
online = True
|
||||||
|
if cutoff_unfair:
|
||||||
|
return
|
||||||
|
|
||||||
# if client was previously marked online, but we have no "new"
|
# if client was previously marked online, but we have no "new"
|
||||||
# readings, then let's look closer to see if it's been long enough to
|
# readings, then let's look closer to see if it's been long enough to
|
||||||
|
|
Loading…
Reference in a new issue