Module: check_mk
Branch: master
Commit: 887a64b80bab773a8a9d9070f0793895624faeed
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=887a64b80bab77…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jun 6 14:44:33 2013 +0200
Logwatch icon no longer uses notes_url
---
ChangeLog | 1 +
web/plugins/icons/builtin.py | 44 ++++++++++++++++++++++++------------------
2 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d547b53..8c6f5e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* Column Perf-O-Meter is now sortable: it sorts after the *first*
performance value. This might not always be the one you like, but
its far better than nothing.
+ * logwatch: Logwatch icon no longer uses notes_url
WATO:
* Allow to configure check-/retry_interval in second precision
diff --git a/web/plugins/icons/builtin.py b/web/plugins/icons/builtin.py
index 80188b8..8208221 100644
--- a/web/plugins/icons/builtin.py
+++ b/web/plugins/icons/builtin.py
@@ -271,36 +271,42 @@ multisite_icons.append({
# | |
# +----------------------------------------------------------------------+
-# Adds the url_prefix of the services site to the notes url configured in this site.
-# It also adds the master_url which will be used to link back to the source site
-# in multi site environments.
-def logwatch_url(sitename, notes_url):
- i = notes_url.index("check_mk/logwatch.py")
+def logwatch_url(sitename, hostname, item):
+ host_item_url = "check_mk/logwatch.py?host=%s&file=%s" % (htmllib.urlencode(hostname), htmllib.urlencode(item))
site = html.site_status[sitename]["site"]
-
master_url = ''
if config.is_multisite():
master_url = '&master_url=' + defaults.url_prefix + 'check_mk/'
- return site["url_prefix"] + notes_url[i:] + master_url
+ return site["url_prefix"] + host_item_url + master_url
+def paint_logwatch(what, row, tags, custom_vars):
+ if what != "service":
+ return
+ if row[what + "_check_command"] == 'check_mk-logwatch':
+ return '<a href="%s"><img class=icon ' \
+ 'src="images/icon_logwatch.png\"></a>' % \
+ logwatch_url(row["site"], row['host_name'], row['service_description'][4:])
+
+multisite_icons.append({
+ 'service_columns': [ 'host_name', 'service_description', 'check_command' ],
+ 'paint': paint_logwatch,
+})
+
+
+# Adds the url_prefix of the services site to the notes url configured in this site.
+# It also adds the master_url which will be used to link back to the source site
+# in multi site environments.
def paint_notes(what, row, tags, custom_vars):
if 'X' in html.display_options:
- # notes_url (only, if not a Check_MK logwatch check pointing to
- # logwatch.py. These is done by a special icon)
notes_url = row[what + "_notes_url_expanded"]
check_command = row[what + "_check_command"]
+ if check_command == 'check_mk-logwatch' and \
+ "check_mk/logwatch.py?host" in notes_url:
+ return
if notes_url:
- # unmodified original logwatch link
- # -> translate into more intelligent icon
- if check_command == 'check_mk-logwatch' \
- and "/check_mk/logwatch.py" in notes_url:
- return '<a href="%s"><img class=icon ' \
- 'src="images/icon_logwatch.png\"></a>' % \
- logwatch_url(row["site"], notes_url)
- else:
- return '<a href="%s"><img class=icon ' \
- 'src="images/icon_notes.gif"></a>' % notes_url
+ return '<a href="%s"><img class=icon ' \
+ 'src="images/icon_notes.gif"></a>' % notes_url
multisite_icons.append({
'columns': [ 'notes_url_expanded', 'check_command' ],