Module: check_mk
Branch: master
Commit: dc65f60d39fed8ae5a97614d2e7bdf6c71f41dae
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dc65f60d39fed8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 7 15:11:03 2015 +0200
Be more tolerant against non UTF-8 characters in items
Note: this makes rules never match for items with invalid characters.
Make sure that in the agent output everything is either UTF-8 or
the section header as an :encoding(foobar) option where foobar is
the correct encoding, e.g. latin1 or IBM347.
---
modules/check_mk.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 69c674e..a221c57 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1927,7 +1927,12 @@ def in_extraconf_servicelist(service_matchers, item):
# FIXME: items in autochecks might contain umlauts, the strings
# are saved as UTF-8 encoded ascii strings. should be saved as
# unicode strings in this case or at least converted after reading.
- result = func(item.decode('utf-8'))
+ try:
+ result = func(item.decode('utf-8'))
+ except:
+ if opt_debug:
+ raise
+ result = False
if result:
return not negate