Module: check_mk
Branch: master
Commit: 292dd47e2c03aff9106292d771197cdee531c8fd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=292dd47e2c03af…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 15 13:31:15 2016 +0200
3380 FIX Fixed graphs in service notifications having spaces in service descriptions
---
.werks/3380 | 10 ++++++++++
ChangeLog | 1 +
notifications/mail | 10 ++++++----
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/.werks/3380 b/.werks/3380
new file mode 100644
index 0000000..7caa0d7
--- /dev/null
+++ b/.werks/3380
@@ -0,0 +1,10 @@
+Title: Fixed graphs in service notifications having spaces in service descriptions
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1460719843
+
+
diff --git a/ChangeLog b/ChangeLog
index 0aedf0c..2a9c447 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -274,6 +274,7 @@
* 3263 Notifications: allow users to restrict by their contact groups...
* 3253 FIX: sms: notification script sms now handles single quotes in the message in
the right way
* 3346 FIX: Re-added envelope sender to asciimail/mail notification plugins
+ * 3380 FIX: Fixed graphs in service notifications having spaces in service
descriptions
BI:
* 3271 New option in aggregation for tuning aggregation of downtimes...
diff --git a/notifications/mail b/notifications/mail
index 2fb5564..015902a 100755
--- a/notifications/mail
+++ b/notifications/mail
@@ -36,6 +36,7 @@
import os, re, sys, subprocess
+import urllib
import urllib2
import base64
@@ -504,14 +505,15 @@ def render_cmk_graphs(context):
svc_desc = context["SERVICEDESC"]
url =
"http://localhost:%d/%s/check_mk/ajax_graph_images.py?host=%s&service=%s" %
\
- (get_apache_port(), os.environ["OMD_SITE"],
context["HOSTNAME"], svc_desc)
+ (get_apache_port(), os.environ["OMD_SITE"],
+ urllib.quote(context["HOSTNAME"]),
urllib.quote(svc_desc))
try:
json_data = urllib2.urlopen(url).read()
except Exception, e:
if opt_debug:
raise
- sys.stderr.write("ERROR: Failed to fetch graphs: %s\n" % e)
+ sys.stderr.write("ERROR: Failed to fetch graphs: %s\nURL: %s\n" % (e,
url))
return []
try:
@@ -519,8 +521,8 @@ def render_cmk_graphs(context):
except Exception, e:
if opt_debug:
raise
- sys.stderr.write("ERROR: Failed to decode graphs: %s\nData: %s\n" %
- (e, json_data))
+ sys.stderr.write("ERROR: Failed to decode graphs: %s\nURL: %s\nData:
%r\n" %
+ (e, url, json_data))
return []
return map(base64.b64decode, base64_strings)