Module: check_mk
Branch: master
Commit: f54de0fc71e94f214d30ba09a865074533642bef
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f54de0fc71e94f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 23 14:06:36 2015 +0100
#2015 FIX Fixed sending notifications for services with umlauts in names
Previous versions were unable to send notifications for services with
umlauts in their service descriptions. This issue has been fixed now.
If you miss notifications, take a look at the notification log at
<tt>var/log/notify.log</tt> (in your OMD sites) and search for
exception tracebacks.
---
.werks/2015 | 14 ++++++++++++++
ChangeLog | 1 +
modules/notify.py | 2 +-
notifications/mail | 10 +++++-----
4 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/.werks/2015 b/.werks/2015
new file mode 100644
index 0000000..dbe546d
--- /dev/null
+++ b/.werks/2015
@@ -0,0 +1,14 @@
+Title: Fixed sending notifications for services with umlauts in names
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1424696700
+
+Previous versions were unable to send notifications for services with
+umlauts in their service descriptions. This issue has been fixed now.
+If you miss notifications, take a look at the notification log at
+<tt>var/log/notify.log</tt> (in your OMD sites) and search for
+exception tracebacks.
diff --git a/ChangeLog b/ChangeLog
index 45f91fb..2c8d308 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -276,6 +276,7 @@
* 1205 FIX: RBN: Fixed match contactgroup condition...
* 1810 FIX: Rule based notifications: Fixed output of non contact mail recipient
address in analyze table...
* 1988 FIX: Gracefully handle invalid empty bulk notification files from previous
buggy versions
+ * 2015 FIX: Fixed sending notifications for services with umlauts in names...
BI:
* 1784 FIX: Fix exception in BI Boxes when parents are being used
diff --git a/modules/notify.py b/modules/notify.py
index 5ea4064..7ae330f 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1358,7 +1358,7 @@ def call_notification_script(plugin, plugin_context):
notify_log(" executing %s" % path)
out = os.popen(path + " 2>&1 </dev/null")
for line in out:
- notify_log("Output: %s" % line.rstrip())
+ notify_log("Output: %s" % line.rstrip().decode('utf-8'))
exitcode = out.close()
if exitcode:
notify_log("Plugin exited with code %d" % (exitcode >> 8))
diff --git a/notifications/mail b/notifications/mail
index 67b6d11..d4aad2e 100755
--- a/notifications/mail
+++ b/notifications/mail
@@ -395,15 +395,15 @@ def send_mail(m, target, from_address):
def fetch_pnp_data(context, params):
try:
# Autodetect the path in OMD environments
- path = "%s/share/pnp4nagios/htdocs/index.php" %
context['OMD_ROOT']
- php_save_path = "-d session.save_path=%s/tmp/php/session" %
context['OMD_ROOT']
+ path = "%s/share/pnp4nagios/htdocs/index.php" %
context['OMD_ROOT'].encode('utf-8')
+ php_save_path = "-d session.save_path=%s/tmp/php/session" %
context['OMD_ROOT'].encode('utf-8')
env = 'REMOTE_USER="check-mk" SKIP_AUTHORIZATION=1'
except:
# Non-omd environment - use plugin argument 1
path = context.get('PARAMETER_1', '')
php_save_path = "" # Using default path
skip_authorization = False
- env = 'REMOTE_USER="%s"' % context['CONTACTNAME']
+ env = 'REMOTE_USER="%s"' %
context['CONTACTNAME'].encode('utf-8')
if not os.path.exists(path):
raise GraphException('Unable to locate pnp4nagios index.php (%s)' %
path)
@@ -413,7 +413,7 @@ def fetch_pnp_data(context, params):
def fetch_num_sources(context):
svc_desc = context['WHAT'] == 'HOST' and '_HOST_' or
context['SERVICEDESC']
infos = fetch_pnp_data(context, '/json?host=%s&srv=%s&view=0' %
- (context['HOSTNAME'], svc_desc))
+
(context['HOSTNAME'].encode('utf-8'), svc_desc.encode('utf-8')))
if not infos.startswith('[{'):
raise GraphException('Unable to fetch graph infos: %s' %
extract_graph_error(infos))
@@ -422,7 +422,7 @@ def fetch_num_sources(context):
def fetch_graph(context, source, view = 1):
svc_desc = context['WHAT'] == 'HOST' and '_HOST_' or
context['SERVICEDESC']
graph = fetch_pnp_data(context,
'/image?host=%s&srv=%s&view=%d&source=%d' %
- (context['HOSTNAME'], svc_desc, view,
source))
+ (context['HOSTNAME'],
svc_desc.encode('utf-8'), view, source))
if graph[:8] != '\x89PNG\r\n\x1a\n':
raise GraphException('Unable to fetch the graph: %s' %
extract_graph_error(graph))