Module: check_mk
Branch: master
Commit: e9618ca514b5d5bdda39bd9c6802f8c842a0eabd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e9618ca514b5d5…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Jan 16 11:32:27 2011 +0100
Multisite: new intelligent logwatch icon
---
ChangeLog | 2 ++
web/.f12 | 2 +-
web/htdocs/images/icon_logwatch.png | Bin 0 -> 7354 bytes
web/plugins/views/painters.py | 21 +++++++++++++++++----
4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fba3b04..4cf2bc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
Multisite:
* custom notes: new macros $URL_PREFIX$ and $SITE$, making
multi site setups easier
+ * new intelligent logwatch icon, using url_prefix in multi site
+ setups
1.1.9i4:
Core, Setup, etc.:
diff --git a/web/.f12 b/web/.f12
index 8c90ab2..2e15990 100644
--- a/web/.f12
+++ b/web/.f12
@@ -1,2 +1,2 @@
sudo cp -prv * /omd/versions/default/share/check_mk/web/
-sudo su - -c 'omd reload wato apache'
+sudo su - -c 'omd restart wato apache'
diff --git a/web/htdocs/images/icon_logwatch.png b/web/htdocs/images/icon_logwatch.png
new file mode 100644
index 0000000..b20f72c
Binary files /dev/null and b/web/htdocs/images/icon_logwatch.png differ
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 99a2b72..308608b 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -107,7 +107,7 @@ multisite_painter_options["ts_date"] = {
icon_columns = [ "acknowledged", "scheduled_downtime_depth",
"downtimes_with_info", "comments_with_info",
"notifications_enabled", "is_flapping",
"modified_attributes_list", "active_checks_enabled",
"accept_passive_checks", "action_url_expanded",
"notes_url_expanded", "in_notification_period",
- "custom_variable_names", "custom_variable_values",
"icon_image", "pnpgraph_present" ]
+ "custom_variable_names", "custom_variable_values",
"icon_image", "pnpgraph_present", "check_command" ]
# Additional columns only to fetch for services
icon_service_columns = [ "service_description" ]
@@ -134,6 +134,12 @@ def pnp_url(row, what = 'graph'):
def pnp_popup_url(row):
return pnp_url(row, 'popup')
+def logwatch_url(sitename, notes_url):
+ i = notes_url.index("/check_mk/logwatch.py")
+ site = html.site_status[sitename]["site"]
+ return site["url_prefix"] + notes_url[i:]
+
+
def wato_link(filename, site, hostname, where):
if 'X' in html.display_options:
prefix = config.site(site)["url_prefix"] + "check_mk/"
@@ -190,9 +196,16 @@ def paint_icons(what, row): # what is "host" or
"service"
if action_url and not ('/pnp4nagios/' in action_url and pnpgraph_present
>= 0):
output += "<a href='%s'><img class=icon
src=\"images/icon_action.gif\"></a>" % row[prefix +
"action_url_expanded"]
- # notes_url
- if row[prefix + "notes_url_expanded"]:
- output += "<a href='%s'><img class=icon
src=\"images/icon_notes.gif\"></a>" % row[prefix +
"notes_url_expanded"]
+ # notes_url (only, if not a Check_MK logwatch check pointing to logwatch.py.
These is done by a special icon)
+ notes_url = row[prefix + "notes_url_expanded"]
+ check_command = row[prefix + "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:
+ output += '<a href="%s"><img class=icon
src="images/icon_logwatch.png\"></a>' %
logwatch_url(row["site"], notes_url)
+ else:
+ output += "<a href='%s'><img class=icon
src=\"images/icon_notes.gif\"></a>" % notes_url
+
# Problem has been acknowledged
if row[prefix + "acknowledged"]: