Module: check_mk
Branch: master
Commit: 7a26ecbbfe800de1842d2ab4674149fb1bf3c10c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7a26ecbbfe800d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 12 13:52:40 2018 +0200
6561 FIX Fixed invalid context button links to "Service globally" and "Graphs globally"
When having a service detail page open, e.g. of a "CPU load" service a user may want to
click on the context button "Service globally" to get a list of all "CPU load" services
in the whole Check_MK setup.
Previous versions were only showing the "CPU load" services of the site the origin service
was located on. The links on the "Service description" worked as intended.
We have now fixed the context button links by removing the "site" filter from the URL.
Change-Id: Id9901ca0b210523c9f402ef862709e2923e55e13
---
.werks/6561 | 18 ++++++++++++++++++
cmk/gui/plugins/views/datasources.py | 14 --------------
cmk/gui/plugins/views/utils.py | 17 ++++-------------
cmk/gui/plugins/visuals/infos.py | 12 ++++++++++++
cmk/gui/visuals.py | 29 ++++++++++++++++++++++++++---
5 files changed, 60 insertions(+), 30 deletions(-)
diff --git a/.werks/6561 b/.werks/6561
new file mode 100644
index 0000000..e8b8781
--- /dev/null
+++ b/.werks/6561
@@ -0,0 +1,18 @@
+Title: Fixed invalid context button links to "Service globally" and "Graphs globally"
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1536672914
+
+When having a service detail page open, e.g. of a "CPU load" service a user may want to
+click on the context button "Service globally" to get a list of all "CPU load" services
+in the whole Check_MK setup.
+
+Previous versions were only showing the "CPU load" services of the site the origin service
+was located on. The links on the "Service description" worked as intended.
+
+We have now fixed the context button links by removing the "site" filter from the URL.
diff --git a/cmk/gui/plugins/views/datasources.py b/cmk/gui/plugins/views/datasources.py
index 19f68aa..95063b9 100644
--- a/cmk/gui/plugins/views/datasources.py
+++ b/cmk/gui/plugins/views/datasources.py
@@ -97,13 +97,6 @@ multisite_datasources["hosts"] = {
# to handle the data provided by the single_spec value of the "hostgroup"
# info, which is in fact the name of the wanted hostgroup
"link_filters" : { "hostgroup": "opthostgroup" },
- # When these filters are set, the site hint will not be added to urls
- # which link to views using this datasource, because the resuling view
- # should show the objects spread accross the sites
- "multiple_site_filters" : [
- "hostgroup",
- "servicegroup",
- ],
}
multisite_datasources["hostsbygroup"] = {
@@ -130,13 +123,6 @@ multisite_datasources["services"] = {
"hostgroup" : "opthostgroup",
"servicegroup" : "optservicegroup",
},
- # When these filters are set, the site hint will not be added to urls
- # which link to views using this datasource, because the resuling view
- # should show the objects spread accross the sites
- "multiple_site_filters" : [
- "hostgroup",
- "servicegroup",
- ],
}
multisite_datasources["servicesbygroup"] = {
diff --git a/cmk/gui/plugins/views/utils.py b/cmk/gui/plugins/views/utils.py
index 531b593..3a69ad5 100644
--- a/cmk/gui/plugins/views/utils.py
+++ b/cmk/gui/plugins/views/utils.py
@@ -359,11 +359,12 @@ def link_to_view(content, row, view_name):
return content
+# TODO: There is duplicated logic with visuals.collect_context_links_of()
def url_to_view(row, view_name):
if display_options.disabled(display_options.I):
return None
- view = get_permitted_views(load_all_views()).get(view_name)
+ view = get_permitted_views(load_all_views())
if view:
# Get the context type of the view to link to, then get the parameters of this
# context type and try to construct the context from the data of the row
@@ -393,18 +394,8 @@ def url_to_view(row, view_name):
except KeyError:
pass
- # Some special handling for the site filter which is meant as optional hint
- # Always add the site filter var when some useful information is available
- add_site_hint = True
- for filter_key in datasource.get('multiple_site_filters', []):
- if filter_key in dict(url_vars):
- add_site_hint = False
-
- # Hack for servicedesc view which is meant to show all services with the given
- # description: Don't add the site filter for this view.
- if view_name == "servicedesc":
- add_site_hint = False
-
+ add_site_hint = visuals.may_add_site_hint(view_name, info_keys=datasource["infos"],
+ single_info_keys=view["single_infos"], filter_names=dict(url_vars).keys())
if add_site_hint and row.get('site'):
url_vars.append(('site', row['site']))
diff --git a/cmk/gui/plugins/visuals/infos.py b/cmk/gui/plugins/visuals/infos.py
index e567013..91d041f 100644
--- a/cmk/gui/plugins/visuals/infos.py
+++ b/cmk/gui/plugins/visuals/infos.py
@@ -39,6 +39,12 @@ declare_info('host', {
title = _('Hostname'),
)),
],
+ # When these filters are set, the site hint will not be added to urls
+ # which link to views using this datasource, because the resuling view
+ # should show the objects spread accross the sites
+ "multiple_site_filters" : [
+ "hostgroup",
+ ],
})
declare_info('service', {
@@ -49,6 +55,12 @@ declare_info('service', {
title = _('Service Description'),
)),
],
+ # When these filters are set, the site hint will not be added to urls
+ # which link to views using this datasource, because the resuling view
+ # should show the objects spread accross the sites
+ "multiple_site_filters" : [
+ "servicegroup",
+ ],
})
declare_info('hostgroup', {
diff --git a/cmk/gui/visuals.py b/cmk/gui/visuals.py
index 17ef328..de060b2 100644
--- a/cmk/gui/visuals.py
+++ b/cmk/gui/visuals.py
@@ -1417,9 +1417,10 @@ def collect_context_links_of(visual_type_name, this_visual, active_filter_vars,
break
vars_values.append((var, val))
- # When all infos of the target visual are showing single site data, add
- # the site hint when available
- if html.var('site') and all([ is_single_site_info(info_key)for info_key in visual['single_infos']]):
+ add_site_hint = may_add_site_hint(name, info_keys=infos.keys(), single_info_keys=visual["single_infos"],
+ filter_names=dict(vars_values).keys())
+
+ if add_site_hint and html.var('site'):
vars_values.append(('site', html.var('site')))
# Optional feature of visuals: Make them dynamically available as links or not.
@@ -1447,6 +1448,28 @@ def collect_context_links_of(visual_type_name, this_visual, active_filter_vars,
return context_links
+
+def may_add_site_hint(visual_name, info_keys, single_info_keys, filter_names):
+ """Whether or not the site hint may be set when linking to a visual with the given details"""
+ # When there is one non single site info used don't add the site hint
+ if [ info_key for info_key in single_info_keys if not is_single_site_info(info_key) ]:
+ return False
+
+ # Alternatively when the infos allow a site hint it is also needed to skip the site hint based
+ # on the filters used by the target visual
+ for info_key in info_keys:
+ for filter_key in infos[info_key].get('multiple_site_filters', []):
+ if filter_key in filter_names:
+ return False
+
+ # Hack for servicedesc view which is meant to show all services with the given
+ # description: Don't add the site filter for this view.
+ if visual_name in [ "servicedesc", "servicedescpnp" ]:
+ return False
+
+ return True
+
+
def transform_old_visual(visual):
if 'context_type' in visual:
if visual['context_type'] in [ 'host', 'service', 'hostgroup', 'servicegroup' ]:
Module: check_mk
Branch: master
Commit: 972c7be42335b1e225a98f08713fe777c4bfc47e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=972c7be42335b1…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Sep 10 15:02:14 2018 +0200
6493 FIX netscaler_vserver: Discovers readable names
The OID .1.3.6.1.4.1.5951.4.1.3.1.1.1 (vsvrName) is used
for the server names. At a certain length the names are
cryptic and therefore unreadable.
In order to get readable names we preferable use the OID
.1.3.6.1.4.1.5951.4.1.3.1.1.59 (vsvrFullName).
After a rediscovery the full server names will be used.
In general the server names and full server names are
equal below a certain length.
Change-Id: I2bda98fd02c4c6992812610bcd589329351a575f
---
.werks/6493 | 19 +++++++++++++++++++
checks/netscaler_vserver | 14 ++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/.werks/6493 b/.werks/6493
new file mode 100644
index 0000000..c55e96c
--- /dev/null
+++ b/.werks/6493
@@ -0,0 +1,19 @@
+Title: netscaler_vserver: Discovers readable names
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1536583837
+Class: fix
+
+The OID .1.3.6.1.4.1.5951.4.1.3.1.1.1 (vsvrName) is used
+for the server names. At a certain length the names are
+cryptic and therefore unreadable.
+
+In order to get readable names we preferable use the OID
+.1.3.6.1.4.1.5951.4.1.3.1.1.59 (vsvrFullName).
+
+After a rediscovery the full server names will be used.
+In general the server names and full server names are
+equal below a certain length.
diff --git a/checks/netscaler_vserver b/checks/netscaler_vserver
index 47c6c57..7afacf7 100644
--- a/checks/netscaler_vserver
+++ b/checks/netscaler_vserver
@@ -85,8 +85,13 @@ factory_settings["netscaler_vserver_default_levels"] = {
def inventory_netscaler_vserver(info):
for line in info:
- if line[0]:
- yield line[0], {}
+ full_server_name = line[10]
+ if full_server_name:
+ server_name = full_server_name
+ else:
+ server_name = line[0]
+ if server_name:
+ yield server_name, {}
def check_netscaler_vserver(item, params, info):
@@ -95,8 +100,8 @@ def check_netscaler_vserver(item, params, info):
for name, ip, port, svr_type, svr_state, \
svr_health, svr_entitytype, request_rate, \
- rx_bytes, tx_bytes in info:
- if name == item:
+ rx_bytes, tx_bytes, full_name in info:
+ if item in [name, full_name]:
svr_state, svr_state_readable = \
netscaler_vserver_states.get(svr_state, ("unknown", 1))
yield svr_state, "Status: %s" % svr_state_readable
@@ -149,6 +154,7 @@ check_info["netscaler_vserver"] = {
43, # NS-ROOT-MIB::vsvrRequestRate
44, # NS-ROOT-MIB::vsvrRxBytesRate
45, # NS-ROOT-MIB::vsvrTxBytesRate
+ 59, # vsvrFullName
]),
"has_perfdata" : True,
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.5951.1"),
Module: check_mk
Branch: master
Commit: 35fc68045d195d0cd5d42ebb929766df1f3c5525
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=35fc68045d195d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 12 10:19:54 2018 +0200
6559 OMD update is now warning when changing editions
During an "omd update" it is possible to switch between Check_MK Editions. For
example to upgrade from Check_MK Raw Edition to Check_MK Enterprise Editions.
It happened that users were accidentally updating Check_MK Enterprise Edition
based sites with Check_MK Raw Editions which e.g. results in reduced
functionality and performance.
During updates OMD is now comparing the old and new Check_MK Editions and asks
the user for confirmation once a change of the edition is detected.
CMK-677
Change-Id: I674cf96f9c126212bc55d4bc8aaa3d7c0c138d35
---
.werks/6559 | 18 ++++++++++++++++++
omd/packages/omd/omd | 26 ++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/.werks/6559 b/.werks/6559
new file mode 100644
index 0000000..65ef81e
--- /dev/null
+++ b/.werks/6559
@@ -0,0 +1,18 @@
+Title: OMD update is now warning when changing editions
+Level: 1
+Component: omd
+Class: feature
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1536646773
+
+During an "omd update" it is possible to switch between Check_MK Editions. For
+example to upgrade from Check_MK Raw Edition to Check_MK Enterprise Editions.
+It happened that users were accidentally updating Check_MK Enterprise Edition
+based sites with Check_MK Raw Editions which e.g. results in reduced
+functionality and performance.
+
+During updates OMD is now comparing the old and new Check_MK Editions and asks
+the user for confirmation once a change of the edition is detected.
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index f3efb4e..e88118e 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -3264,6 +3264,14 @@ def main_update(args, options=None):
"Update!", "Abort"):
bail_out("Aborted.")
+ # In case the user changes the installed Check_MK Edition during update let the
+ # user confirm this step.
+ from_edition, to_edition = _get_edition(from_version), _get_edition(to_version)
+ if from_edition != to_edition and not opt_force and not dialog_yesno(
+ "You are updating from %s Edition to %s Edition. Is this intended?" %
+ (from_edition.title(), to_edition.title())):
+ bail_out("Aborted.")
+
start_logging(g_sitedir + '/var/log/update.log')
sys.stdout.write("%s - Updating site '%s' from version %s to %s...\n\n" %
@@ -3302,6 +3310,24 @@ def main_update(args, options=None):
stop_logging()
+def _get_edition(omd_version):
+ """Returns the long Check_MK Edition name or "unknown" of the given OMD version"""
+ parts = omd_version.split(".")
+ if parts[-1] == "demo":
+ edition_short = parts[-2]
+ else:
+ edition_short = parts[-1]
+
+ if edition_short == "cre":
+ return "raw"
+ elif edition_short == "cee":
+ return "enterprise"
+ elif edition_short == "cme":
+ return "managed"
+ else:
+ return "unknown"
+
+
def main_umount(args, options=None):
if options is None:
options = {}
Module: check_mk
Branch: master
Commit: 3ef5b51a4032b68b7703d3fa083aafdc10295bb1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ef5b51a4032b6…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Sep 11 15:48:07 2018 +0200
6495 FIX Bulk discovery: "Include subfolders" does not make sense for a selection of hosts
Change-Id: I5e86c86d70b15dc7bf2fda612db3b02c21b3fd49
---
.werks/6495 | 15 +++++++++++++++
cmk/gui/plugins/wato/utils/__init__.py | 24 +++++++++++++-----------
cmk/gui/wato/__init__.py | 14 +++++++++++---
3 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/.werks/6495 b/.werks/6495
new file mode 100644
index 0000000..eea854c
--- /dev/null
+++ b/.werks/6495
@@ -0,0 +1,15 @@
+Title: Bulk discovery: "Include subfolders" does not make sense for a selection of hosts
+Level: 1
+Component: wato
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1536673221
+Class: fix
+
+A selection of hosts is already given in the following situations:
+<ul>
+<li>in the current folder below <i>Selected hosts: Discovery</i>,</li>
+<li>Below <i>Bulk import</i> a automatic service discovery for
+imported/selected hosts can be executed</li>
+</ul>
diff --git a/cmk/gui/plugins/wato/utils/__init__.py b/cmk/gui/plugins/wato/utils/__init__.py
index e5334ff..fdab5c4 100644
--- a/cmk/gui/plugins/wato/utils/__init__.py
+++ b/cmk/gui/plugins/wato/utils/__init__.py
@@ -178,12 +178,23 @@ def monitoring_macro_help():
"the macro <tt>$_HOSTFOO$</tt> being replaced with <tt>bar</tt> ")
-def vs_bulk_discovery(render_form=False):
+def vs_bulk_discovery(render_form=False, include_subfolders=True):
if render_form:
render = "form"
else:
render = None
+ if include_subfolders:
+ selection_elements = [Checkbox(label = _("Include all subfolders"), default_value = True)]
+ else:
+ selection_elements = []
+
+ selection_elements += [
+ Checkbox(label = _("Only include hosts that failed on previous discovery"), default_value = False),
+ Checkbox(label = _("Only include hosts with a failed discovery check"), default_value = False),
+ Checkbox(label = _("Exclude hosts where the agent is unreachable"), default_value = False),
+ ]
+
return Dictionary(
title = _("Bulk discovery"),
render = render,
@@ -201,16 +212,7 @@ def vs_bulk_discovery(render_form=False):
)),
("selection", Tuple(
title = _("Selection"),
- elements = [
- Checkbox(label = _("Include all subfolders"),
- default_value = True),
- Checkbox(label = _("Only include hosts that failed on previous discovery"),
- default_value = False),
- Checkbox(label = _("Only include hosts with a failed discovery check"),
- default_value = False),
- Checkbox(label = _("Exclude hosts where the agent is unreachable"),
- default_value = False),
- ]
+ elements = selection_elements
)),
("performance", Tuple(
title = _("Performance options"),
diff --git a/cmk/gui/wato/__init__.py b/cmk/gui/wato/__init__.py
index 0d57e58..5608a27 100644
--- a/cmk/gui/wato/__init__.py
+++ b/cmk/gui/wato/__init__.py
@@ -895,8 +895,10 @@ class ModeFolder(WatoMode):
if config.user.may("wato.edit_hosts"):
html.button("_bulk_edit", _("Edit"))
html.button("_bulk_cleanup", _("Cleanup"))
+
if config.user.may("wato.services"):
html.button("_bulk_inventory", _("Discovery"))
+
if not self._folder.locked_hosts():
if config.user.may("wato.parentscan"):
html.button("_parentscan", _("Parentscan"))
@@ -4656,10 +4658,16 @@ class ModeBulkDiscovery(WatoMode):
html.begin_form("bulkinventory", method="POST")
html.hidden_fields()
- vs = cmk.gui.plugins.wato.vs_bulk_discovery(render_form=True)
-
msgs = []
- if not self._all:
+ if self._all:
+ vs = cmk.gui.plugins.wato.vs_bulk_discovery(render_form=True)
+ else:
+ # "Include subfolders" does not make sense for a selection of hosts
+ # which is already given in the following situations:
+ # - in the current folder below 'Selected hosts: Discovery'
+ # - Below 'Bulk import' a automatic service discovery for
+ # imported/selected hosts can be executed
+ vs = cmk.gui.plugins.wato.vs_bulk_discovery(render_form=True, include_subfolders=False)
msgs.append(_("You have selected <b>%d</b> hosts for bulk discovery.") % len(hosts_to_discover))
selection = self._bulk_discovery_params["selection"]
self._bulk_discovery_params["selection"] = [False] + list(selection[1:])