Module: check_mk
Branch: master
Commit: 1608eba1014c020edf1226a925495b643784c32e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1608eba1014c02…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 16 11:41:29 2014 +0100
Show all custom variables of hosts and services in the detail views
There is now a new column painter for showing all custom variables of a
host or service. This painter has been added to the details views of
host and service.
---
.werks/449 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/status.css | 13 +++++++++++++
web/plugins/views/builtin.py | 17 +++++++----------
web/plugins/views/painters.py | 26 ++++++++++++++++++++++++++
5 files changed, 57 insertions(+), 10 deletions(-)
diff --git a/.werks/449 b/.werks/449
new file mode 100644
index 0000000..36cece1
--- /dev/null
+++ b/.werks/449
@@ -0,0 +1,10 @@
+Title: Show all custom variables of hosts and services in the detail views
+Level: 2
+Component: multisite
+Version: 1.2.5i1
+Date: 1389868818
+Class: feature
+
+There is now a new column painter for showing all custom variables of a
+host or service. This painter has been added to the details views of
+host and service.
diff --git a/ChangeLog b/ChangeLog
index 88526b9..b853da9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -117,6 +117,7 @@
* 0247 New mkp package for web applications: iNag / nagstatus / nagios status.dat...
* 0429 Implemented role permissions for dashboards...
* 0430 It is now possible to define custom time ranges in PNP graph search...
+ * 0449 Show all custom variables of hosts and services in the detail views...
* 0302 FIX: Fixed highlight of choosen elements in foldertee/views snapin in
Chrome/IE
* 0239 FIX: Fixed incorrect html formatting when displaying host or service
comments...
* 0307 FIX: Increased performance of multisite GUI with a large userbase...
diff --git a/web/htdocs/status.css b/web/htdocs/status.css
index fa5c0bb..bd3099a 100644
--- a/web/htdocs/status.css
+++ b/web/htdocs/status.css
@@ -382,3 +382,16 @@ img.siteicon {
height: 24px;
border: 1px solid #666;
}
+
+table.customvars {
+ border-collapse: collapse;
+ padding: 0px;
+}
+table.data tr.data td table.customvars td {
+ /* border: 1px solid #ccc; */
+ padding: 0px 5px 0px 0px;
+}
+table.data tr.data td table.customvars td:last-child {
+ border-left: 1px solid #bbb;
+ padding-left: 5px;
+}
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index be54aaa..f21f2e4 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -146,20 +146,15 @@ multisite_builtin_views.update({
'group_painters': [('sitealias', 'sitehosts'),
('host_with_state', 'host')],
'hard_filters': ['summary_host'],
- 'hard_filtervars':
[('is_service_in_notification_period',
- '-1'),
+ 'hard_filtervars':
[('is_service_in_notification_period', '-1'),
('optservicegroup', ''),
- ('is_service_notifications_enabled',
- '-1'),
- ('is_host_in_notification_period',
- '-1'),
+ ('is_service_notifications_enabled',
'-1'),
+ ('is_host_in_notification_period',
'-1'),
('is_in_downtime', '-1'),
- ('is_service_scheduled_downtime_depth',
- '-1'),
+ ('is_service_scheduled_downtime_depth',
'-1'),
('is_service_acknowledged', '-1'),
('host', ''),
- ('is_service_active_checks_enabled',
- '-1'),
+ ('is_service_active_checks_enabled',
'-1'),
('is_summary_host', '0'),
('service', ''),
('check_command', ''),
@@ -1061,6 +1056,7 @@ multisite_builtin_views.update({
('host_in_downtime', None),
('host_in_notifper', None),
('host_notifper', None),
+ ('host_custom_vars', None),
('num_services', None),
('num_services_ok', 'host_ok'),
('num_services_warn', 'host_warn'),
@@ -1288,6 +1284,7 @@ multisite_builtin_views.update({
('svc_in_notifper', None),
('svc_notifper', None),
('service_display_name', None),
+ ('svc_custom_vars', None),
('check_manpage', None),
('svc_custom_notes', None),
('svc_pnpgraph', None),
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 8c3dd07..873f27b 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -848,6 +848,25 @@ multisite_painters["svc_servicelevel"] = {
"sorter" : 'servicelevel',
}
+def paint_custom_vars(what, row, blacklist=[]):
+ items = row[what + "_custom_variables"].items()
+ items.sort()
+ code = '<table class=customvars>'
+ for varname, value in items:
+ if varname not in blacklist:
+ code +=
'<tr><td>%s</td><td>%s</td></tr>' % (varname,
value)
+ code += '</table>'
+ return "", code
+
+multisite_painters["svc_custom_vars"] = {
+ "title" : _("Service custom variables"),
+ "columns" : [ "service_custom_variables" ],
+ "paint" : lambda row: paint_custom_vars('service', row),
+}
+
+
+
+
# _ _ _
# | | | | ___ ___| |_ ___
# | |_| |/ _ \/ __| __/ __|
@@ -1299,6 +1318,13 @@ multisite_painters["host_servicelevel"] = {
"sorter" : 'servicelevel',
}
+multisite_painters["host_custom_vars"] = {
+ "title" : _("Host custom variables"),
+ "columns" : [ "host_custom_variables" ],
+ "paint" : lambda row: paint_custom_vars('host', row, [
'FILENAME', 'TAGS']),
+}
+
+
# _ _ _
# | | | | ___ ___| |_ __ _ _ __ ___ _ _ _ __ ___
# | |_| |/ _ \/ __| __/ _` | '__/ _ \| | | | '_ \/ __|