Module: check_mk
Branch: master
Commit: 1ad380edac05a7b7f6fd515d81d33a083d75dcc4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1ad380edac05a7…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 17 14:43:04 2012 +0200
FIX: reset counter in case of (broken) future time
---
.bugs/630 | 7 +++++--
ChangeLog | 1 +
modules/check_mk_base.py | 2 ++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/.bugs/630 b/.bugs/630
index be89306..c2b4827 100644
--- a/.bugs/630
+++ b/.bugs/630
@@ -1,9 +1,9 @@
Title: Reset counter in case of time step
Component: core
-State: open
+Class: bug
+State: done
Date: 2012-02-02 15:08:44
Targetversion: 1.2.0
-Class: bug
If get_counter detects a future timestamp then it
should reset the counter to the current time so
@@ -11,3 +11,6 @@ that at least the next time the counter will work.
This happens e.g. in at Windows, because the agent
was sending invalid timestamps in older versions
that are lying in the future and are now repaired.
+
+2012-04-17 14:42:52: changed state open -> done
+fixed.
diff --git a/ChangeLog b/ChangeLog
index 5143458..53b2dbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.2.0b2:
Core:
* FIX: Cluster host checks were UNKNOWN all the time
+ * FIX: reset counter in case of (broken) future time
WATO:
* Added new permission "move hosts" to allow/deny moving of hosts in WATO
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 86cb88e..2054205 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -599,6 +599,8 @@ def get_counter(countername, this_time, this_val,
allow_negative=False):
last_time, last_val = g_counters.get(countername)
timedif = this_time - last_time
if timedif <= 0: # do not update counter
+ # Reset counter to a (hopefully) reasonable value
+ g_counters[countername] = (this_time, this_val)
# Do not suppress this check on check_mk -nv
if opt_dont_submit:
return 1.0, 0.0