Module: check_mk
Branch: master
Commit: ecbee16d76aa2536c28ac69158f5613a5fec30c4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ecbee16d76aa25…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jun 6 14:10:32 2013 +0200
Revert "logwatch link no longer uses notes_url"
This reverts commit fb7554434f8cdce727d0d2e90d007ee4b3f6f5d5.
---
ChangeLog | 1 -
modules/check_mk.py | 11 +++++++++--
scripts/setup.sh | 1 +
web/plugins/icons/builtin.py | 30 +++++++++++++++---------------
4 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fae1738..d547b53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,7 +9,6 @@
* 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 18f6ec6..8ca387a 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -109,6 +109,7 @@ 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
@@ -1773,6 +1774,12 @@ 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"
@@ -1812,10 +1819,10 @@ def create_nagios_servicedefs(outfile, hostname):
host_name\t\t\t%s
service_description\t\t%s
check_interval\t\t%d
-%s check_command\t\t\tcheck_mk-%s
+%s%s check_command\t\t\tcheck_mk-%s
}
-""" % ( template, hostname, description, check_interval,
+""" % ( template, hostname, description, check_interval, logwatch,
extra_service_conf_of(hostname, description), checkname ))
checknames_to_define.add(checkname)
diff --git a/scripts/setup.sh b/scripts/setup.sh
index 7f672d9..aafa7ff 100755
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -498,6 +498,7 @@ 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 759439c..80188b8 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, hostname, item):
- host_item_url = "check_mk/logwatch.py?host=%s&file=%s" %
(urllib.quote(hostname), urllib.quote(item))
+def logwatch_url(sitename, notes_url):
+ i = notes_url.index("check_mk/logwatch.py")
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"] + 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,
-})
+ return site["url_prefix"] + notes_url[i:] + master_url
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:
- return '<a href="%s"><img class=icon ' \
+ # 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
multisite_icons.append({