Module: check_mk
Branch: master
Commit: 939da91860b2ae1b1a655cbd43b112b0d99695e1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=939da91860b2ae…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Mar 1 11:45:01 2017 +0100
4478 systemtime: Now takes the agent data cache file age into account
Change-Id: I5182f025799193995e5710afbee378453ae97fa0
---
.werks/4478 | 11 +++++++++++
checks/systemtime | 16 ++++++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/.werks/4478 b/.werks/4478
new file mode 100644
index 0000000..a5cdc36
--- /dev/null
+++ b/.werks/4478
@@ -0,0 +1,11 @@
+Title: systemtime: Now takes the agent data cache file age into account
+Level: 1
+Component: checks
+Class: feature
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1488365020
+
+
diff --git a/checks/systemtime b/checks/systemtime
index d86b4bc..363d505 100644
--- a/checks/systemtime
+++ b/checks/systemtime
@@ -24,22 +24,30 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
systemtime_default_values = (30, 60) # warn/crit sec. offset
+
def inventory_systemtime(info):
if len(info) >= 1:
return [(None, "systemtime_default_values")]
+
def check_systemtime(item, params, info):
if len(info) == 0:
return (3, "no information sent by agent")
systemtime = int(info[0][0])
- ourtime = int(time.time())
- offset = systemtime - ourtime
+ try:
+ systemtime += get_agent_data_time()
+ except NameError:
+ pass
+
+ ourtime = int(time.time())
+ offset = systemtime - ourtime
warn, crit = params
- infotext = "Offset is %d sec (warn/crit at %d/%d sec)" % (offset, warn,
crit)
- perfdata = [ ("offset", offset, warn, crit, 0) ]
+ infotext = "Offset is %d sec (warn/crit at %d/%d sec)" % (offset, warn,
crit)
+ perfdata = [ ("offset", offset, warn, crit, 0) ]
if abs(offset) >= crit:
return (2, infotext, perfdata)