Module: check_mk
Branch: master
Commit: 54563aa900fede1a3fba9156d35d99c5a5597817
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=54563aa900fede…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Nov 17 18:07:36 2011 +0100
Multisite: cleanup up debug code
---
ChangeLog | 2 ++
web/htdocs/check_mk.css | 19 +++++++++++++++++++
web/htdocs/config.py | 2 ++
web/htdocs/htmllib.py | 2 ++
web/htdocs/views.py | 8 ++++----
web/plugins/wato/check_mk_configuration.py | 15 ++++++++++++---
6 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3e25df3..7a4100d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,8 @@
* Only show most frequently used context buttons (configurable
in multisite.mk via context_buttons_to_show)
* Show icon if user has modified a view's filter settings
+ * New config option debug_livestatus_queries, normal debug
+ mode does not include this anymore
WATO:
* Evolved to full featured monitoring configuration tool!
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index 8da5dbd..e49eb3b 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -158,6 +158,16 @@ body.main table.header td.right img {
top: 5px;
}
+body.main div.urldebug {
+ color: white;
+ width: 100%;
+ font-size: 8pt;
+ font-family: monospace;
+ position: relative;
+ top: -14px;
+}
+
+
/* The content page footer containing optional status icons */
table.footer {
margin-top: 10px;
@@ -1023,6 +1033,15 @@ tr.data td.pnpgraph img {
border: 1px solid #888;
margin: 7px 3px 3px 0px;
}
+
+div.livestatus.message {
+ position: fixed;
+ bottom: -10px;
+ left: 10px;
+ font-size: 8pt;
+ z-index: 20;
+}
+
/*
_ _
| | __ _ _ _ ___ _ _| |_ ___
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index cb869e4..9993474 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -488,6 +488,8 @@ custom_links = {}
# \_/ \__,_|_| |_|\___/ \__,_|___/
#
+debug_livestatus_queries = False
+
# Show livestatus errors in multi site setup if some sites are
# not reachable.
show_livestatus_errors = True
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 32631cb..bfdae94 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -622,6 +622,8 @@ class html:
"%s <b id=headertime>%s</b>
<a href=\"http://mathias-kettner.de\"><img
src=\"images/mk_logo_small.gif\"/></a></td></tr></table>"
%
(title, login_text, time.strftime("%H:%M")))
self.write("<hr class=header>\n")
+ if config.debug:
+ self.write("<div class=urldebug>%s</div>" %
self.makeuri([]))
def body_start(self, title=''):
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 492184c..0bfc925 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1703,10 +1703,10 @@ def query_data(datasource, columns, add_columns, add_headers,
only_sites = [], l
html.live.set_prepend_site(True)
if limit != None:
html.live.set_limit(limit + 1) # + 1: We need to know, if limit is exceeded
- if config.debug and html.output_format == "html" and 'W' in
html.display_options:
- html.begin_foldable_container("debug_lq", "x", True,
_("Livestatus Query:"), indent=False)
- html.write("<div
class=message><tt>%s</tt></div>\n" %
(query.replace('\n', '<br>\n')))
- html.end_foldable_container()
+ if config.debug_livestatus_queries \
+ and html.output_format == "html" and 'W' in
html.display_options:
+ html.write('<div class="livestatus message"
onmouseover="this.style.display=\'none\';">'
+ '<tt>%s</tt></div>\n' %
(query.replace('\n', '<br>\n')))
if only_sites:
html.live.set_only_sites(only_sites)
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 1944440..83c0d95 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -45,9 +45,18 @@ register_configvar(group,
"debug",
Checkbox(title = _("Debug mode"),
label = _("enable debug mode"),
- help = _("When Multisite is running in debug mode, all Livestatus
queries done in "
- "views are output. Also when errors occur a complete Python
stack trace "
- "is being output."),
+ help = _("When Multisite is running in debug mode, interal Python error
messages "
+ "are being displayed and various debug information in other
places is "
+ "also available."),
+ default_value = False),
+ domain = "multisite")
+
+register_configvar(group,
+ "debug_livestatus_queries",
+ Checkbox(title = _("Debug Livestatus queries"),
+ label = _("enable debug of Livestatus queries"),
+ help = _("With this option turned on all Livestatus queries made by
Multisite "
+ "in order to render views are being displayed."),
default_value = False),
domain = "multisite")