Module: check_mk
Branch: master
Commit: ebf9b5d7bda110887edbb6c8961aaec8fc7ded75
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ebf9b5d7bda110…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 6 14:59:48 2014 +0100
#1493 Added config option "Default filter group" to set the initial network
topology view filter
The new "Network Topology: Default Filter Group" option can be used to initially
render a filtered
network topology view when opening it instead of a view which shows all hosts.
---
.werks/1493 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/config/builtin.py | 3 +++
web/plugins/dashboard/builtin.py | 12 ++++++++----
web/plugins/wato/check_mk_configuration.py | 23 +++++++++++++++++++++++
5 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/.werks/1493 b/.werks/1493
new file mode 100644
index 0000000..84fc6ee
--- /dev/null
+++ b/.werks/1493
@@ -0,0 +1,10 @@
+Title: Added config option "Default filter group" to set the initial network
topology view filter
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.5i7
+Date: 1415282309
+Class: feature
+
+The new "Network Topology: Default Filter Group" option can be used to
initially render a filtered
+network topology view when opening it instead of a view which shows all hosts.
diff --git a/ChangeLog b/ChangeLog
index e60f40c..ef702d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,7 @@
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
+ * 1493 Added config option "Default filter group" to set the initial
network topology view filter...
* 1164 FIX: Fixed links from servicegroup overviews to single servicegroups
* 1166 FIX: Also prevting stylesheet update issues during version updates (just like
for JS files)
* 1481 FIX: Fix broken layout of Host-, Service- and Contactgroup filters
diff --git a/web/plugins/config/builtin.py b/web/plugins/config/builtin.py
index 6e98986..d1054da 100644
--- a/web/plugins/config/builtin.py
+++ b/web/plugins/config/builtin.py
@@ -242,3 +242,6 @@ user_localizations = default_user_localizations
# Write WATO folder permissions to auth.php file
export_folder_permissions = False
+
+# Name of the hostgroup to filter the network topology view by default
+topology_default_filter_group = None
diff --git a/web/plugins/dashboard/builtin.py b/web/plugins/dashboard/builtin.py
index 5d6dd0a..a7f6672 100644
--- a/web/plugins/dashboard/builtin.py
+++ b/web/plugins/dashboard/builtin.py
@@ -187,6 +187,13 @@ builtin_dashboards["main"] = {
#Only work in OMD installations
if defaults.omd_site:
+ def topology_url():
+ return defaults.url_prefix + 'nagvis/frontend/nagvis-js/index.php?' + \
+
'mod=Map&header_template=on-demand-filter&header_menu=1&label_show=1'
+ \
+ '&sources=automap&act=view&backend_id=' +
defaults.omd_site + \
+
'&render_mode=undirected&url_target=main&filter_group=' + \
+ (config.topology_default_filter_group or '')
+
builtin_dashboards["topology"] = {
"single_infos": [],
"context" : {},
@@ -199,10 +206,7 @@ if defaults.omd_site:
{
"type" : "url",
"title" : "Topology of Site " +
defaults.omd_site,
- "url" : defaults.url_prefix +
'nagvis/frontend/nagvis-js/index.php?' + \
-
'mod=Map&header_template=on-demand-filter&header_menu=1&label_show=1'
+ \
-
'&sources=automap&act=view&backend_id=' + defaults.omd_site + \
-
'&render_mode=undirected&url_target=main',
+ "urlfunc" : 'topology_url',
"reload_on_resize" : True,
"position" : (1, 1),
"size" : (GROW, GROW),
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 9d86a84..1792534 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -466,6 +466,29 @@ register_configvar(group,
domain = "multisite",
)
+# Helper that retrieves the list of hostgroups via Livestatus
+# use alias by default but fallback to name if no alias defined
+def list_hostgroups():
+ groups = dict(html.live.query("GET hostgroups\nCache: reload\nColumns: name
alias\n"))
+ return [ (name, groups[name] or name) for name in groups.keys() ]
+
+register_configvar(group,
+ "topology_default_filter_group",
+ Optional(DropdownChoice(
+ choices = list_hostgroups,
+ sorted = True,
+ ),
+ title = _("Network Topology: Default Filter Group"),
+ help = _("By default the network topology view shows you the parent / child
relations "
+ "of all hosts within your local site. The list can be filtered
based on hostgroup "
+ "memberships by the users. You can define a default group to use
for filtering "
+ "which is used when a user opens the network topology
view."),
+ none_label = _("Show all hosts when opening the network topology
view"),
+ default_value = None,
+ ),
+ domain = "multisite"
+)
+
#.
# .--WATO----------------------------------------------------------------.
# | __ ___ _____ ___ |