Module: check_mk
Branch: master
Commit: 71502305bd35522d626e8c2f543dc3d0cf23cf30
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=71502305bd3552…
Author: Marcel Schulte <ms(a)mathias-kettner.de>
Date: Tue Oct 11 12:07:22 2016 +0200
3936 FIX chrony: support new params dictionary and rule "State of NTP time
synchronisation"
---
.werks/3936 | 10 ++++++++++
ChangeLog | 1 +
checks/chrony | 15 +++++++++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/.werks/3936 b/.werks/3936
new file mode 100644
index 0000000..1b13cbf
--- /dev/null
+++ b/.werks/3936
@@ -0,0 +1,10 @@
+Title: chrony: support new params dictionary and rule "State of NTP time
synchronisation"
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i2
+Date: 1476180339
+
+
diff --git a/ChangeLog b/ChangeLog
index 7b0cc4a..9556f05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@
* 3748 FIX: vertias_vcs: Fix empty agent section for standard xinetd
configuration...
* 3935 FIX: FIX avaya_45xx_cpu: check got UNKNOWN using Nagios core
* 3896 FIX: Agent RPMs: Fixing dependency issue with old check_mk-agent-oracle-*.rpm
and check_mk-agent-logwatch-*.rpm
+ * 3936 FIX: chrony: support new params dictionary and rule "State of NTP time
synchronisation"
WATO:
* 3915 User access times: New icon when never logged in; New column "last
seen"
diff --git a/checks/chrony b/checks/chrony
index 8e66547..08f2742 100644
--- a/checks/chrony
+++ b/checks/chrony
@@ -26,6 +26,11 @@
ntp_default_levels = (10, 200.0, 500.0) # stratum, ms offset
+factory_settings["ntp_time_default_levels"] = {
+ "ntp_levels" : ntp_default_levels,
+ "alert_delay" : (300, 3600),
+}
+
# Example output from agent:
# <<<chrony>>>
# Reference ID : 212.18.3.18 (
ntp1.m-online.net)
@@ -53,7 +58,7 @@ def parse_chrony(info):
def inventory_chrony(info):
parsed = parse_chrony(info)
if parsed:
- return [(None, "ntp_default_levels")]
+ return [(None, {})]
def check_chrony(_no_item, params, info):
@@ -63,7 +68,12 @@ def check_chrony(_no_item, params, info):
return
# Prepare parameters
- crit_stratum, warn, crit = params
+ if type(params) == tuple:
+ params = {
+ "ntp_levels": params,
+ "alert_delay": (300, 3600),
+ }
+ crit_stratum, warn, crit = params["ntp_levels"]
# Check offset and stratum, output a few info texsts
offset = float(parsed["System time"].split()[0]) * 1000 # converted to ms
@@ -97,4 +107,5 @@ check_info["chrony"] = {
'service_description': 'NTP Time',
'has_perfdata': True,
'group': 'ntp_time',
+ 'default_levels_variable': "ntp_time_default_levels",
}