Module: check_mk
Branch: master
Commit: a66ccf2b2c8f527b89c2a418727e1eb5e51355de
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a66ccf2b2c8f52…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu May 12 14:57:45 2016 +0200
split up the view introduced in werk 3129 into two views. Some cosmetic improvements
---
web/plugins/views/builtin.py | 54 ++++++++++++++++++++++++++++++++++++-----
web/plugins/views/painters.py | 16 +++++++++---
2 files changed, 60 insertions(+), 10 deletions(-)
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index 1d73861..d9e1726 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -155,16 +155,19 @@ multisite_builtin_views.update({
'sorters': [('site', False), ('site_host',
False)],
'title': _('All hosts (Mini)'),
'topic': _('Hosts')},
- 'service_discovery': {'browser_reload': 0,
+ 'unmonitored_services': {'browser_reload': 0,
'column_headers': 'pergroup',
'datasource': 'service_discovery',
- 'description': _('Differences to currently monitored
services on a host.'),
+ 'description': _('Services not being monitored due to
configuration.'),
+ 'context': {
+ 'discovery_state': {'discovery_state_var0':
'on',
+ 'discovery_state_var1': '',
+ 'discovery_state_var2': ''}
+ },
'group_painters': [('sitealias', None),
('host_with_state', 'host')],
'hard_filters': [],
- 'hard_filtervars': [('site', ''),
- ('host', ''),
- ('opthostgroup', '')],
+ 'hard_filtervars': [('state',
'unmonitored')],
'hidden': False,
'hide_filters': [],
'layout': 'table',
@@ -189,8 +192,47 @@ multisite_builtin_views.update({
'opthost_contactgroup'],
'sorters': [('site', False),
('site_host', False)],
- 'title': _('Discovery of host'),
+ 'title': _('Unmonitored services'),
'topic': _('Services')},
+ 'pending_discovery': {'browser_reload': 0,
+ 'column_headers': 'pergroup',
+ 'datasource': 'service_discovery',
+ 'description': _('Differences to currently monitored
services on a host.'),
+ 'context': {
+ 'discovery_state': {'discovery_state_var0':
'',
+ 'discovery_state_var1': 'on',
+ 'discovery_state_var2': 'on'}
+ },
+ 'group_painters': [('sitealias', None),
+ ('host_with_state', 'host')],
+ 'hard_filters': [],
+ 'hard_filtervars': [('state', ['new',
'vanished'])],
+ 'hidden': False,
+ 'hide_filters': [],
+ 'layout': 'table',
+ 'mustsearch': False,
+ 'name': 'service_discovery',
+ 'num_columns': 1,
+ 'owner': '',
+ 'painters': [('service_discovery_service', None),
+ ('service_discovery_check', None),
+ ('service_discovery_state', None)],
+ 'play_sounds': False,
+ 'public': True,
+ 'show_filters': ['host_scheduled_downtime_depth',
+ 'host_in_notification_period',
+ 'hoststate',
+ 'siteopt',
+ 'host_acknowledged',
+ 'hostregex',
+ 'host_notifications_enabled',
+ 'opthostgroup',
+ 'host_check_command',
+ 'opthost_contactgroup'],
+ 'sorters': [('site', False),
+ ('site_host', False)],
+ 'title': _('Pending service discovery'),
+ 'topic': _('Problems')},
'allservices': {'browser_reload': 90,
'column_headers': 'pergroup',
'datasource': 'services',
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 638a227..b5a34cf 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -1735,12 +1735,20 @@ def paint_discovery_output(field, row):
if field == "discovery_state":
ruleset_url =
"wato.py?mode=edit_ruleset&varname=ignored_services"
discovery_url = "wato.py?mode=inventory&host=%s&mode=inventory"
% row["host_name"]
+
return None, {
- "ignored" : '<a href="%s">Hidden by
rule</a>' % ruleset_url,
- "vanished" : '<a href="%s">No longer
available</a>' % discovery_url,
- "unmonitored" : '<a href="%s">Newly
discovered</a>' % discovery_url
+ "ignored" : html.render_icon_button(ruleset_url, 'Disabled
(configured away by admin)', 'rulesets') + "Disabled (configured away by
admin)",
+ "vanished" : html.render_icon_button(discovery_url,
'Vanished (checked, but no longer exist)', 'services') + "Vanished
(checked, but no longer exist)",
+ "unmonitored" : html.render_icon_button(discovery_url,
'Available (missing)', 'services') + "Available (missing)"
}.get(value, value)
- return None, value
+ elif field == "discovery_service" and row["discovery_state"] ==
"vanished":
+ link =
"view.py?view_name=service&site=%s&host=%s&service=%s" % (
+ html.urlencode(row["site"]),
+ html.urlencode(row["host_name"]),
+ html.urlencode(value))
+ return None, "<div><a
href=\"%s\">%s</a></div>" % (link, value)
+ else:
+ return None, value
multisite_painters["service_discovery_state"] = {
"title": _("Service discovery: State"),