Module: check_mk
Branch: master
Commit: 727e5c06275d1c86fcfd1f0a30f936edbda983a2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=727e5c06275d1c…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jul 2 14:48:47 2018 +0200
6299 FIX mk_logwatch: If no MK_CONFDIR/logwatch.cfg exists all configuration files below
MK_CONFDIR/logwatch.d were ignored. Fixed that!
Change-Id: I044f590cfaa8567587e37cc7e100eb79dd1682d4
---
.werks/6299 | 10 ++++++++++
agents/plugins/mk_logwatch | 8 +++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/6299 b/.werks/6299
new file mode 100644
index 0000000..6f7622e
--- /dev/null
+++ b/.werks/6299
@@ -0,0 +1,10 @@
+Title: mk_logwatch: If no MK_CONFDIR/logwatch.cfg exists all configuration files below
MK_CONFDIR/logwatch.d were ignored. Fixed that!
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1530535554
+Class: fix
+
+
diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch
index 0211325..db6a606 100755
--- a/agents/plugins/mk_logwatch
+++ b/agents/plugins/mk_logwatch
@@ -187,7 +187,13 @@ def parse_pattern(level, pattern, line):
return (level, compiled)
def read_config():
- config_lines = [ line.rstrip() for line in filter(is_not_comment,
file(config_filename).readlines()) ]
+ config_lines = []
+ try:
+ config_lines += [ line.rstrip() for line in filter(is_not_comment,
file(config_filename).readlines()) ]
+ except IOError, e:
+ if debug:
+ raise
+
# Add config from a logwatch.d folder
for config_file in glob.glob(config_dir):
config_lines += [ line.rstrip() for line in filter(is_not_comment,
file(config_file).readlines()) ]