Module: check_mk
Branch: master
Commit: fb7554434f8cdce727d0d2e90d007ee4b3f6f5d5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb7554434f8cdc…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jun 6 13:17:24 2013 +0200
logwatch link no longer uses notes_url
---
ChangeLog | 1 +
modules/check_mk.py | 11 ++---------
scripts/setup.sh | 1 -
web/plugins/icons/builtin.py | 30 +++++++++++++++---------------
4 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3192df3..63adc24 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 link no longer uses notes_url
WATO:
* Allow to configure check-/retry_interval in second precision
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 8ca387a..18f6ec6 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -109,7 +109,6 @@ www_group = None # unset
nagios_startscript = '/etc/init.d/nagios'
nagios_binary = '/usr/sbin/nagios'
nagios_config_file = '/etc/nagios/nagios.cfg'
-logwatch_notes_url =
"/nagios/logwatch.php?host=%s&file=%s"
rrdcached_socket = None # used by prediction.py
rrd_path = None # used by prediction.py
@@ -1774,12 +1773,6 @@ def create_nagios_servicedefs(outfile, hostname):
else:
template = passive_service_template
- # Hardcoded for logwatch check: Link to logwatch.php
- if checkname == "logwatch":
- logwatch = " notes_url\t\t\t" + (logwatch_notes_url %
(urllib.quote(hostname), urllib.quote(item))) + "\n"
- else:
- logwatch = "";
-
# Services Dependencies
for dep in deps:
outfile.write("define servicedependency {\n"
@@ -1819,10 +1812,10 @@ def create_nagios_servicedefs(outfile, hostname):
host_name\t\t\t%s
service_description\t\t%s
check_interval\t\t%d
-%s%s check_command\t\t\tcheck_mk-%s
+%s check_command\t\t\tcheck_mk-%s
}
-""" % ( template, hostname, description, check_interval, logwatch,
+""" % ( template, hostname, description, check_interval,
extra_service_conf_of(hostname, description), checkname ))
checknames_to_define.add(checkname)
diff --git a/scripts/setup.sh b/scripts/setup.sh
index aafa7ff..7f672d9 100755
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -498,7 +498,6 @@ check_result_path = '$check_result_path'
nagios_status_file = '$nagios_status_file'
nagios_conf_dir = '$nagconfdir'
nagios_user = '$nagiosuser'
-logwatch_notes_url =
'${url_prefix}check_mk/logwatch.py?host=%s&file=%s'
www_group = '$wwwgroup'
nagios_config_file = '$nagios_config_file'
nagios_startscript = '$nagios_startscript'
diff --git a/web/plugins/icons/builtin.py b/web/plugins/icons/builtin.py
index 80188b8..759439c 100644
--- a/web/plugins/icons/builtin.py
+++ b/web/plugins/icons/builtin.py
@@ -274,32 +274,32 @@ 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" %
(urllib.quote(hostname), urllib.quote(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 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({
+ 'columns': [ 'host_name', 'service_description',
'check_command' ],
+ 'paint': paint_logwatch,
+})
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 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 ' \
+ return '<a href="%s"><img class=icon ' \
'src="images/icon_notes.gif"></a>' %
notes_url
multisite_icons.append({