Module: check_mk
Branch: master
Commit: 2bcb1e0987e5b462b44763fa49f41f320b920568
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2bcb1e0987e5b4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 28 08:56:34 2016 +0200
3443 FIX mk_logwatch: Fixed exception in agent plugin configuration parsing error
handling
---
.werks/3443 | 10 ++++++++++
ChangeLog | 1 +
agents/plugins/mk_logwatch | 10 ++++++----
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/.werks/3443 b/.werks/3443
new file mode 100644
index 0000000..a9d9d6b
--- /dev/null
+++ b/.werks/3443
@@ -0,0 +1,10 @@
+Title: mk_logwatch: Fixed exception in agent plugin configuration parsing error handling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1461826579
+
+
diff --git a/ChangeLog b/ChangeLog
index 5b813fa..134e27f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -193,6 +193,7 @@
* 3441 FIX: ps: Added missing graph for number of processes
* 3429 FIX: ps, mem.linux, mem.include: fixed missing parse_proc_meminfo_bytes during
precompiling
* 3126 FIX: fixed crash in some wmi-based checks when items disappear from the agent
output
+ * 3443 FIX: mk_logwatch: Fixed exception in agent plugin configuration parsing error
handling
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch
index 24c758a..96f548f 100755
--- a/agents/plugins/mk_logwatch
+++ b/agents/plugins/mk_logwatch
@@ -90,13 +90,15 @@ def is_not_comment(line):
def parse_filenames(line):
return line.split()
-def parse_pattern(level, pattern):
+def parse_pattern(level, pattern, line):
if level not in [ 'C', 'W', 'I', 'O' ]:
- raise(Exception("Invalid pattern line '%s'" % line))
+ raise Exception("Invalid pattern line '%s'" % line)
+
try:
compiled = re.compile(pattern)
except:
- raise(Exception("Invalid regular expression in line '%s'" %
line))
+ raise Exception("Invalid regular expression in line '%s'" %
line)
+
return (level, compiled)
def read_config():
@@ -119,7 +121,7 @@ def read_config():
elif level == 'R':
rewrite_list.append(pattern)
else:
- level, compiled = parse_pattern(level, pattern)
+ level, compiled = parse_pattern(level, pattern, line)
cont_list = [] # List of continuation patterns
rewrite_list = [] # List of rewrite patterns
patterns.append((level, compiled, cont_list, rewrite_list))