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
Module: check_mk
Branch: master
Commit: 78c084f689eb4d7e6483ab871d52d27b30cdd6db
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=78c084f689eb4d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 7 14:46:25 2015 +0200
Fix service rule execution for more complex regular expressions
e.g. such containing \ and +
---
.bugs/2298 | 8 ++++++--
modules/check_mk.py | 6 +++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/.bugs/2298 b/.bugs/2298
index 037371d..6deab96 100644
--- a/.bugs/2298
+++ b/.bugs/2298
@@ -1,8 +1,12 @@
Title: Service Discovery Checks reports disabled services as new
Component: checks
-State: open
+Class: bug
+State: done
Date: 2015-04-01 14:03:37
Targetversion: 1.2.7
-Class: bug
error does not occur in 1.2.6, but in 2015-04-01
+
+2015-04-07 14:45:29: changed state open -> done
+Fixed. The detection for regular expressions was incomplete and just checked
+for the characters '*$|[', the complete list is now .?*+^$|[](){}\
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 9382e32..69c674e 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1686,9 +1686,11 @@ def get_rule_options(entry):
# This function tries to parse the pattern and return different kind of matching
# functions which can then be performed faster than just using the regex match.
def convert_pattern(pattern):
+ # TODO: Wouldn't it be faster to declare these functions in global scope
+ # i.e. only once?
def is_regex(pattern):
for c in pattern:
- if c in '*$|[':
+ if c in '.?*+^$|[](){}\\':
return True
return False
@@ -1717,6 +1719,7 @@ def convert_pattern(pattern):
elif is_prefix_match(pattern):
# prefix match with tailing .*
pattern = pattern[:-2]
+ # TODO: Should we not rather use startswith()?
return negate, lambda txt: txt[:len(pattern)] == pattern
elif is_regex(pattern):
@@ -1725,6 +1728,7 @@ def convert_pattern(pattern):
else:
# prefix match without any regex chars
+ # TODO: Should we not rather use startswith()?
return negate, lambda txt: txt[:len(pattern)] == pattern
Module: check_mk
Branch: master
Commit: 508c375ad086e9a086a105290505f5bf248eba89
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=508c375ad086e9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 7 10:31:59 2015 +0200
Updated bug entries #2310
---
.bugs/2310 | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/.bugs/2310 b/.bugs/2310
new file mode 100644
index 0000000..2cc09dc
--- /dev/null
+++ b/.bugs/2310
@@ -0,0 +1,11 @@
+Title: Quicksearch: service list of host not sorted
+Component: multisite
+State: open
+Date: 2015-04-07 10:31:05
+Targetversion: future
+Class: nastiness
+
+When you enter h:somehost s:... then you will see a list of the
+service of the host. This list is not but should be sorted
+alphabetically. Might be the case that only with CMC it's not
+sorted...