Module: check_mk
Branch: master
Commit: e1570af4e0e82cdcefb4c7356c62f09527baab57
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e1570af4e0e82c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Sep 26 12:23:56 2014 +0200
#1407 FIX Fix exception in rule based notification on non-Ascii characters in log message
---
.werks/1407 | 9 +++++++++
ChangeLog | 1 +
modules/notify.py | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.werks/1407 b/.werks/1407
new file mode 100644
index 0000000..90bf678
--- /dev/null
+++ b/.werks/1407
@@ -0,0 +1,9 @@
+Title: Fix exception in rule based notification on non-Ascii characters in log message
+Level: 2
+Component: notifications
+Compatible: compat
+Version: 1.2.5i6
+Date: 1411727016
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index ebf9490..1ab5d69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -135,6 +135,7 @@
* 1400 Added example notification script for Pushover to
doc/treasures/notifications...
* 1156 FIX: Graphs in HTML mails are now sent again where they where missing...
* 1157 FIX: Fixed SMS plugin on at least debian (distrs which have no
sendsms/smssend)...
+ * 1407 FIX: Fix exception in rule based notification on non-Ascii characters in log
message
BI:
* 1406 Assume PEND in count_ok aggregations if all nodes are PEND...
diff --git a/modules/notify.py b/modules/notify.py
index 24e4c35..57b90d9 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1874,12 +1874,12 @@ def core_notification_log(plugin, plugin_context):
log_message = "%s NOTIFICATION: %s;%s;%s;%s;%s" % (
what, contact, spec, state, plugin or "plain email", output)
if monitoring_core == "cmc":
- livestatus_send_command("LOG;" + log_message)
+ livestatus_send_command("LOG;" +
log_message.encode("utf-8"))
else:
# Nagios and friends do not support logging via an
# external command. We write the files into a help file
# in var/check_mk/notify. If the users likes he can
# replace that file with a symbolic link to the nagios
# log file. But note: Nagios logging might not atomic.
- file(notification_core_log, "a").write("[%d] %s\n" %
(time.time(), log_message))
+ file(notification_core_log, "a").write("[%d] %s\n" %
(time.time(), log_message.encode("utf-8")))