Module: check_mk
Branch: master
Commit: a40a71ef3c1883dd5292d629b3582253689245b9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a40a71ef3c1883…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Mar 21 11:53:33 2019 +0100
7128 FIX Display vanished and disabled clustered services on discovery page of the nodes
Change-Id: I12241c5dcfb26945c7cbdbea2cc109dba6dba982
---
.werks/7128 | 11 +++++++++++
cmk/gui/wato/pages/services.py | 34 ++++++++++++++++++++++++++++++++++
cmk_base/discovery.py | 13 ++++++-------
3 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/.werks/7128 b/.werks/7128
new file mode 100644
index 0000000..8dc07fb
--- /dev/null
+++ b/.werks/7128
@@ -0,0 +1,11 @@
+Title: Display vanished and disabled clustered services on discovery page of the nodes
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1553149689
+
+
diff --git a/cmk/gui/wato/pages/services.py b/cmk/gui/wato/pages/services.py
index bba55ef..5d97db7 100644
--- a/cmk/gui/wato/pages/services.py
+++ b/cmk/gui/wato/pages/services.py
@@ -98,6 +98,8 @@ class DiscoveryState(object):
LEGACY = "legacy"
CLUSTERED_OLD = "clustered_old"
CLUSTERED_NEW = "clustered_new"
+ CLUSTERED_VANISHED = "clustered_vanished"
+ CLUSTERED_IGNORED = "clustered_ignored"
ACTIVE_IGNORED = "active_ignored"
CUSTOM_IGNORED = "custom_ignored"
LEGACY_IGNORED = "legacy_ignored"
@@ -112,6 +114,8 @@ class DiscoveryState(object):
cls.REMOVED,
cls.CLUSTERED_OLD,
cls.CLUSTERED_NEW,
+ cls.CLUSTERED_VANISHED,
+ cls.CLUSTERED_IGNORED,
]
@@ -739,6 +743,18 @@ class ModeAjaxServiceDiscovery(WatoWebApiMode):
autochecks_to_save[(check_type, item)] = paramstring
saved_services.add(descr)
+ elif table_source in [
+ DiscoveryState.CLUSTERED_VANISHED,
+ DiscoveryState.CLUSTERED_IGNORED,
+ ]:
+ # We keep vanished clustered services on the node with the following
reason:
+ # If a service is mapped to a cluster then there are already operations
+ # for adding, removing, etc. of this service on the cluster. Therefore
we
+ # do not allow any operation for this clustered service on the related
node.
+ # We just display the clustered service state (OLD, NEW, VANISHED).
+ autochecks_to_save[(check_type, item)] = paramstring
+ saved_services.add(descr)
+
if apply_changes:
need_sync = False
if remove_disabled_rule or add_disabled_rule:
@@ -1421,6 +1437,15 @@ class DiscoveryPageRenderer(object):
"monitoring."),
),
TableGroupEntry(
+ DiscoveryState.CLUSTERED_VANISHED,
+ show_bulk_actions=False,
+ title=_("Vanished clustered services (located on cluster
host)"),
+ help_text=_(
+ "These services have been found on this host and have been
mapped to "
+ "a cluster host by a rule in the set <i>Clustered
services</i> but disappeared "
+ "from this host."),
+ ),
+ TableGroupEntry(
DiscoveryState.MONITORED,
show_bulk_actions=True,
title=_("Monitored services"),
@@ -1487,6 +1512,15 @@ class DiscoveryPageRenderer(object):
"them."),
),
TableGroupEntry(
+ table_group=DiscoveryState.CLUSTERED_IGNORED,
+ show_bulk_actions=False,
+ title=_("Disabled clustered services (located on cluster
host)"),
+ help_text=_(
+ "These services have been found on this host and have been
mapped to "
+ "a cluster host by a rule in the set <i>Clustered
services</i> but disabled via "
+ "<i>Disabled services</i> or <i>Disabled
checks</i>."),
+ ),
+ TableGroupEntry(
table_group=DiscoveryState.ACTIVE_IGNORED,
show_bulk_actions=False,
title=_("Disabled active checks"),
diff --git a/cmk_base/discovery.py b/cmk_base/discovery.py
index ae98174..8a4e6ed 100644
--- a/cmk_base/discovery.py
+++ b/cmk_base/discovery.py
@@ -277,8 +277,8 @@ def discover_on_host(mode,
else:
counts["removed"] += 1
- # Silently keep clustered services
elif check_source.startswith("clustered_"):
+ # Silently keep clustered services
new_items[(check_plugin_name, item)] = paramstring
else:
@@ -888,12 +888,11 @@ def _get_node_services(hostname, ipaddress, sources,
multi_host_sections, on_err
else:
continue # ignore
- if hostname != config_cache.host_of_clustered_service(hostname, descr):
- if check_source == "vanished":
- del services[(check_plugin_name,
- item)] # do not show vanished clustered services here
- else:
- services[(check_plugin_name, item)] = ("clustered_" +
check_source, paramstring)
+ clustername = config_cache.host_of_clustered_service(hostname, descr)
+ if hostname != clustername:
+ if config.service_ignored(clustername, check_plugin_name, descr):
+ check_source = "ignored"
+ services[(check_plugin_name, item)] = ("clustered_" + check_source,
paramstring)
_merge_manual_services(services, hostname, on_error)
return services