Module: check_mk
Branch: master
Commit: 1963e4ca0e7f9599e7264ed3c5dd280283338dc7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1963e4ca0e7f95…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 27 14:11:59 2018 +0200
Check table is now filterable (services +/- clustered services)
Previously the check table was always filtering clustered services.
For two fixes it was now necessary to fetch either only clustered and
the regular including clustered services.
Future: Clean up the check table implementation to make it easier
to deal with these different views on the check table.
Change-Id: Ie0b797a9b61837f64740c7b3342a3808ae892cf4
---
cmk_base/check_table.py | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/cmk_base/check_table.py b/cmk_base/check_table.py
index e6ac18b..bd1f3a8 100644
--- a/cmk_base/check_table.py
+++ b/cmk_base/check_table.py
@@ -36,10 +36,16 @@ import cmk_base.rulesets as rulesets
import cmk_base.piggyback as piggyback
import cmk_base.item_state as item_state
+# TODO: Refactor this to OO. The check table needs to be an object.
# Returns check table for a specific host
# Format: (checkname, item) -> (params, description)
-def get_check_table(hostname, remove_duplicates=False, use_cache=True, world='config', skip_autochecks=False):
+#
+# filter_mode: None -> default, returns only checks for this host
+# filter_mode: "include_clustered" -> returns checks of own host, including clustered checks
+# filter_mode: "only_clustered" -> returns only checks belonging to clusters
+def get_check_table(hostname, remove_duplicates=False, use_cache=True,
+ world='config', skip_autochecks=False, filter_mode=None):
import cmk_base.discovery as discovery
if config.is_ping_host(hostname):
@@ -47,12 +53,16 @@ def get_check_table(hostname, remove_duplicates=False, use_cache=True, world='co
# speed up multiple lookup of same host
check_table_cache = cmk_base.config_cache.get_dict("check_tables")
+ table_cache_id = hostname, filter_mode
- if not skip_autochecks and use_cache and hostname in check_table_cache:
+ if not skip_autochecks and use_cache and table_cache_id in check_table_cache:
+ # TODO: The whole is_dual_host handling needs to be cleaned up. The duplicate checking
+ # needs to be done in all cases since a host can now have a lot of different data
+ # sources.
if remove_duplicates and config.is_dual_host(hostname):
- return _remove_duplicate_checks(check_table_cache[hostname])
+ return _remove_duplicate_checks(check_table_cache[table_cache_id])
else:
- return check_table_cache[hostname]
+ return check_table_cache[table_cache_id]
check_table = {}
@@ -123,8 +133,15 @@ def get_check_table(hostname, remove_duplicates=False, use_cache=True, world='co
descr = config.service_description(hostname, checkname, item)
if config.service_ignored(hostname, checkname, descr):
return
- if hostname != config.host_of_clustered_service(hostname, descr):
+
+ svc_is_mine = hostname == config.host_of_clustered_service(hostname, descr)
+ print hostname, descr, svc_is_mine, filter_mode
+ if filter_mode is None and not svc_is_mine:
return
+
+ elif filter_mode == "only_clustered" and svc_is_mine:
+ return
+
deps = service_deps(hostname, descr)
check_table[(checkname, item)] = (params, descr, deps)
@@ -168,7 +185,7 @@ def get_check_table(hostname, remove_duplicates=False, use_cache=True, world='co
deps.append(d)
if not skip_autochecks and use_cache:
- check_table_cache[hostname] = check_table
+ check_table_cache[table_cache_id] = check_table
if remove_duplicates:
return _remove_duplicate_checks(check_table)
@@ -176,8 +193,8 @@ def get_check_table(hostname, remove_duplicates=False, use_cache=True, world='co
return check_table
-def get_precompiled_check_table(hostname, remove_duplicates=True, world="config"):
- host_checks = get_sorted_check_table(hostname, remove_duplicates, world)
+def get_precompiled_check_table(hostname, remove_duplicates=True, world="config", filter_mode=None):
+ host_checks = get_sorted_check_table(hostname, remove_duplicates, world, filter_mode=filter_mode)
precomp_table = []
for check_plugin_name, item, params, description, _unused_deps in host_checks:
# make these globals available to the precompile function
@@ -254,12 +271,13 @@ def _remove_duplicate_checks(check_table):
# if there already is a TCP based one with the same
# description. E.g: df vs hr_fs.
# TODO: Clean this up!
-def get_sorted_check_table(hostname, remove_duplicates=False, world="config"):
+def get_sorted_check_table(hostname, remove_duplicates=False, world="config", filter_mode=None):
# Convert from dictionary into simple tuple list. Then sort
# it according to the service dependencies.
unsorted = [ (checkname, item, params, descr, deps)
for ((checkname, item), (params, descr, deps))
- in get_check_table(hostname, remove_duplicates=remove_duplicates, world=world).items() ]
+ in get_check_table(hostname, remove_duplicates=remove_duplicates, world=world,
+ filter_mode=filter_mode).items() ]
def cmp(a, b):
if a[3] < b[3]:
Module: check_mk
Branch: master
Commit: c503f217427804eaa52371c4ea3ef030e10da08e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c503f217427804…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Apr 27 10:59:32 2018 +0200
Don't import names directly, use their hierarchical names.
Explicit is better than implicit, and the previous naming was confusing
(even if it was shorter). Actually the naming was so confusing that it
contained a bug... :-) This has been fixed on the way, a werk is coming in
a separate commit.
With some global names now free, rename some local variables back to
something more readable.
Change-Id: Iab5ba58aee8ee1007bf01967bb2aeb71da348cea
---
cmk/ec/main.py | 84 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 42 insertions(+), 42 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=c503f21742…
Module: check_mk
Branch: master
Commit: 1d8139eb006e21a2bb13c1441e0b7b9239ba9161
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1d8139eb006e21…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Apr 27 11:47:25 2018 +0200
6011 FIX Fixed host name translation via regexes in the EC
Using a host name translation via regexes resulted in an exception in the
event console, this has been fixed. Note that this was a regression
starting with the earliest 1.4.0 relase, the 1.2.8 series is OK.
Change-Id: Ibf357e49969dd893c23bad27c18c7d5c456f2338
---
.werks/6011 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/.werks/6011 b/.werks/6011
new file mode 100644
index 0000000..e6bdf51
--- /dev/null
+++ b/.werks/6011
@@ -0,0 +1,12 @@
+Title: Fixed host name translation via regexes in the EC
+Level: 1
+Component: ec
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1524822276
+Class: fix
+
+Using a host name translation via regexes resulted in an exception in the
+event console, this has been fixed. Note that this was a regression
+starting with the earliest 1.4.0 relase, the 1.2.8 series is OK.
Module: check_mk
Branch: master
Commit: d3d9ea19938eb89562987c45c98ec3ef9061af78
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d3d9ea19938eb8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 25 15:00:28 2018 +0200
6034 FIX Fixed adding combined graphs to reports
When clicking on the context menu of a combined graph and adding it to a report,
the element that is added to the report is not created correctly. When trying
to edit the element later an exception "TypeError (unhashable type: 'dict')" is
shown.
Delete the element after the update and re-add it to the report should fix the
issue.
Change-Id: I88bc3c6680e2f8b2a7486ff34b177dcdf84285b0
---
.werks/6034 | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/.werks/6034 b/.werks/6034
new file mode 100644
index 0000000..00fa698
--- /dev/null
+++ b/.werks/6034
@@ -0,0 +1,17 @@
+Title: Fixed adding combined graphs to reports
+Level: 1
+Component: reporting
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.6.0i1
+Date: 1524661146
+
+When clicking on the context menu of a combined graph and adding it to a report,
+the element that is added to the report is not created correctly. When trying
+to edit the element later an exception "TypeError (unhashable type: 'dict')" is
+shown.
+
+Delete the element after the update and re-add it to the report should fix the
+issue.