Module: check_mk
Branch: master
Commit: e218b707d0feb15ac65e73471e66cd73fadfc6bb
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e218b707d0feb1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 3 11:07:02 2015 +0100
The Check_MK services "Check_MK Discovery", "Check_MK Inventory" and "Check_MK HW/SW Inventory" need
data from the Check_MK agent on agent based hosts. These check were contacting the agent on their own
on every execution which could lead to logwatch messages not being processed by the agent because they
were already processed by the discovery/inventory checks.
We now set these checks to use the agent cache (if available and if recent enough). This makes the
checks only contact the agent when neccessary. This should never happen when the host is being monitored
regularly because the regular monitoring ensures that the cache is available and up-to-date.
Conflicts:
ChangeLog
modules/check_mk.py
---
.werks/2859 | 17 +++++++++++++++++
ChangeLog | 3 ++-
checks/check_cmk_inv | 2 +-
modules/automation.py | 4 ++--
modules/check_mk.py | 26 +++++++++++++++++++++++++-
modules/check_mk_base.py | 3 +--
modules/discovery.py | 6 ++----
modules/inventory.py | 3 +--
8 files changed, 51 insertions(+), 13 deletions(-)
diff --git a/.werks/2859 b/.werks/2859
new file mode 100644
index 0000000..cf3d7e2
--- /dev/null
+++ b/.werks/2859
@@ -0,0 +1,17 @@
+Title: Check_MK Discovery/Inventory and HW/SW Inventory services are now always using caches (if available)
+Level: 2
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1449135634
+
+The Check_MK services "Check_MK Discovery", "Check_MK Inventory" and "Check_MK HW/SW Inventory" need
+data from the Check_MK agent on agent based hosts. These check were contacting the agent on their own
+on every execution which could lead to logwatch messages not being processed by the agent because they
+were already processed by the discovery/inventory checks.
+
+We now set these checks to use the agent cache (if available and if recent enough). This makes the
+checks only contact the agent when neccessary. This should never happen when the host is being monitored
+regularly because the regular monitoring ensures that the cache is available and up-to-date.
diff --git a/ChangeLog b/ChangeLog
index 5128363..b357cf7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,8 +52,8 @@
* 2803 netapp_api_volumes: clustered volumes now longer show the current node name in the service description...
NOTE: Please refer to the migration notes!
* 2780 cisco_vss: detect this check on newer (15.1) devices
- * 2866 ewon: Added support for monitoring Wagner OxyReduct devices with their data exposed through an ewon router...
* 2874 netstat_an.bat: Restrict output of connections to TCP, safes performance
+ * 2866 ewon: Added support for monitoring Wagner OxyReduct devices with their data exposed through an ewon router...
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
@@ -133,6 +133,7 @@
* 2876 FIX: mk_logwatch: Avoid parsing lines that are currently being written by application...
* 2806 FIX: oracle_rman: introduced missing WATO, allows configuration of backup age
* 2883 FIX: default.php template: fixed id_string while creating default template, e.g. for custom checks
+ * 2859 FIX: Check_MK Discovery/Inventory and HW/SW Inventory services are now always using caches (if available)...
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/check_cmk_inv b/checks/check_cmk_inv
index 642516b..b2e11a7 100644
--- a/checks/check_cmk_inv
+++ b/checks/check_cmk_inv
@@ -31,7 +31,7 @@ def check_cmk_inv(params):
return "--hw-changes=%d --sw-changes=%d" % (params.get("hw_changes", 0), params.get("sw_changes", 0))
active_check_info['cmk_inv'] = {
- "command_line" : 'cmk $ARG1$ --inventory-as-check $HOSTNAME$',
+ "command_line" : 'cmk $ARG1$ --cache --inventory-as-check $HOSTNAME$',
"argument_function" : check_cmk_inv,
"service_description" : lambda x: "Check_MK HW/SW Inventory",
"has_perfdata" : False,
diff --git a/modules/automation.py b/modules/automation.py
index b11b83c..d43c575 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -180,8 +180,8 @@ def automation_try_discovery(args):
# TODO: Remove this unlucky option opt_use_cachefile. At least do not
# handle this option so deep in the code. It should only be handled
# by top-level functions.
- global opt_use_cachefile, check_max_cachefile_age
- opt_use_cachefile = use_caches
+ set_use_cachefile(use_caches)
+ global check_max_cachefile_age
if use_caches:
check_max_cachefile_age = inventory_max_cachefile_age
hostname = args[0]
diff --git a/modules/check_mk.py b/modules/check_mk.py
index f5fc03e..d39a585 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1345,10 +1345,26 @@ def agent_target_version(hostname):
return spec # return the whole spec in case of an "at least version" config
+# FIXME TODO: Cleanup the whole caching crap
+orig_opt_use_cachefile = None
orig_check_max_cachefile_age = None
orig_cluster_max_cachefile_age = None
orig_inventory_max_cachefile_age = None
+
+def set_use_cachefile(state=True):
+ global opt_use_cachefile, orig_opt_use_cachefile
+ orig_opt_use_cachefile = opt_use_cachefile
+ opt_use_cachefile = state
+
+
+def restore_use_cachefile():
+ global opt_use_cachefile, orig_opt_use_cachefile
+ if orig_opt_use_cachefile != None:
+ opt_use_cachefile = orig_opt_use_cachefile
+ orig_opt_use_cachefile = None
+
+
# TODO: Why 1000000000? Can't we really clean this up to a global variable which can
# be toggled to enforce the cache usage (if available). This way we would not need
# to store the original values of the different caches and modify them etc.
@@ -1369,11 +1385,17 @@ def enforce_using_agent_cache():
def restore_original_agent_caching_usage():
global check_max_cachefile_age, cluster_max_cachefile_age, inventory_max_cachefile_age
+ global orig_check_max_cachefile_age, orig_cluster_max_cachefile_age, \
+ orig_inventory_max_cachefile_age
+
if orig_check_max_cachefile_age != None:
check_max_cachefile_age = orig_check_max_cachefile_age
cluster_max_cachefile_age = orig_cluster_max_cachefile_age
inventory_max_cachefile_age = orig_inventory_max_cachefile_age
+ orig_check_max_cachefile_age = None
+ orig_cluster_max_cachefile_age = None
+ orig_inventory_max_cachefile_age = None
#.
# .--SNMP----------------------------------------------------------------.
@@ -4536,6 +4558,7 @@ def do_check_keepalive():
args = cmdline.split()
if '--cache' in args:
args.remove('--cache')
+ set_use_cachefile()
enforce_using_agent_cache()
# FIXME: remove obsolete check-inventory
@@ -4599,6 +4622,7 @@ def do_check_keepalive():
sys.stderr.flush()
cleanup_globals() # Prepare for next check
+ restore_use_cachefile()
restore_original_agent_caching_usage()
# Check if all global variables are clean, but only in verbose logging mode
@@ -5017,7 +5041,7 @@ for o,a in opts:
sys.stderr.write("Please use the option -c separated by the other options.\n")
sys.exit(1)
elif o == '--cache':
- opt_use_cachefile = True
+ set_use_cachefile()
enforce_using_agent_cache()
elif o == '--no-tcp':
opt_no_tcp = True
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index fa86075..e25eae0 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -341,8 +341,7 @@ def get_host_info(hostname, ipaddress, checkname, max_cachefile_age=None, ignore
info = []
at_least_one_without_exception = False
exception_texts = []
- global opt_use_cachefile
- opt_use_cachefile = True
+ set_use_cachefile()
is_snmp_error = False
for node in nodes:
# If an error with the agent occurs, we still can (and must)
diff --git a/modules/discovery.py b/modules/discovery.py
index a5b729d..fc6e011 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -978,9 +978,7 @@ def get_check_preview(hostname, use_caches, do_snmp_scan, on_error):
# Sorry. The whole caching stuff is the most horrible hack in
# whole Check_MK. Nobody dares to clean it up, YET. But that
# day is getting nearer...
- global opt_use_cachefile
- old_opt_use_cachefile = opt_use_cachefile
- opt_use_cachefile = True
+ set_use_cachefile()
opt_dont_submit = True # hack for get_realhost_info, avoid skipping because of check interval
if check_type not in check_info:
@@ -1013,7 +1011,7 @@ def get_check_preview(hostname, use_caches, do_snmp_scan, on_error):
else:
tcp_error = output
- opt_use_cachefile = old_opt_use_cachefile
+ restore_use_cachefile()
global g_check_type, g_checked_item
g_check_type = check_type
diff --git a/modules/inventory.py b/modules/inventory.py
index ccada05..d6ded22 100644
--- a/modules/inventory.py
+++ b/modules/inventory.py
@@ -157,8 +157,7 @@ def do_inv(hostnames):
# No hosts specified: do all hosts and force caching
if hostnames == None:
hostnames = all_active_realhosts()
- global opt_use_cachefile
- opt_use_cachefile = True
+ set_use_cachefile()
errors = []
for hostname in hostnames:
Module: check_mk
Branch: master
Commit: 2c5619034c63d3a769e294fc654fbbf16dde55a3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2c5619034c63d3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 3 09:55:26 2015 +0100
Added note about the parse_ps resulting format
---
checks/ps | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/checks/ps b/checks/ps
index e7bb97d..78da52d 100644
--- a/checks/ps
+++ b/checks/ps
@@ -177,6 +177,13 @@ def ps_parse_process_entries(parsed):
return parsed
+# Produces a list of lists where each sub list is built as follows:
+# [
+# [None, (u'root', u'35156', u'4372', u'00:00:05/2-14:14:49', u'1'), u'/sbin/init'],
+# ]
+# First element: The node the data comes from in a cluster or None
+# Second element: The process info tuple (see ps.include: check_ps_common() for details on the elements)
+# Third element: The process command line
def parse_ps(info):
cpu_cores, parsed = ps_merge_wmic_info(info)
Module: check_mk
Branch: master
Commit: 140a13084c2a47b1bcb824a63e87ce86f46eaa2a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=140a13084c2a47…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Dec 2 17:24:58 2015 +0100
Fixed typo
---
web/plugins/wato/active_checks.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index c64e2be..8f798f7 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -996,8 +996,8 @@ register_rule(group,
),
( "cert_host",
TextAscii(
- title = _("Check Cerficate of different IP / DNS Name"),
- help = _("For each SSL cerficate on a host, a different IP address is needed. "
+ title = _("Check Certificate of different IP / DNS Name"),
+ help = _("For each SSL certificate on a host, a different IP address is needed. "
"Here, you can specify the address if it differs from the "
"address from the host primary address."),
),
Module: check_mk
Branch: master
Commit: f1f593521634b3cbebd9ffb87de244ec89c27071
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f1f593521634b3…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Wed Dec 2 16:52:00 2015 +0100
#2866 ewon: Added support for monitoring Wagner OxyReduct devices with their data exposed through an ewon router
The Wagner OxyReduct device (or chamber) can't be monitored directly but via the eWON 2005CD router
their measurements can be exposed via snmp. This check monitors the OxyReduct through this channel
and lays the groundwork for monitoring further devices exposed through the same router.
---
.werks/2866 | 11 ++
ChangeLog | 1 +
checkman/ewon | 26 ++++
checks/ewon | 237 ++++++++++++++++++++++++++++++++++
web/plugins/metrics/check_mk.py | 6 +
web/plugins/wato/check_parameters.py | 19 +++
6 files changed, 300 insertions(+)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=f1f5935216…