Module: check_mk
Branch: master
Commit: b8a4870a49b877c03c40857cb07a608ca9913037
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b8a4870a49b877…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jun 29 13:53:55 2015 +0200
#2362 FIX mk_logwatch: fix cases where one logfile is listsed more than once in
logwatch.cfg
One example of such a case:
F+:logwatch.cfg
/var/log/syslog /var/log/kern.log
C panic
C Oops
W generic protection rip
W .*Unrecovered read error - auto reallocate failed
/var/log/kern.log
C INFO
F-:
In the old implementation the line with <tt>C INFO</tt> would never be
executed.
Now it is appended at the bottom of the other patterns for <tt>kern.log</tt>.
Thanks to Gregor Hoffleit for the patch!
---
.werks/2362 | 26 ++++++++++++++++++++++++++
ChangeLog | 1 +
agents/plugins/mk_logwatch | 6 +++++-
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/.werks/2362 b/.werks/2362
new file mode 100644
index 0000000..e6c36b4
--- /dev/null
+++ b/.werks/2362
@@ -0,0 +1,26 @@
+Title: mk_logwatch: fix cases where one logfile is listsed more than once in
logwatch.cfg
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1435578702
+Class: fix
+
+One example of such a case:
+
+F+:logwatch.cfg
+/var/log/syslog /var/log/kern.log
+ C panic
+ C Oops
+ W generic protection rip
+ W .*Unrecovered read error - auto reallocate failed
+
+/var/log/kern.log
+ C INFO
+F-:
+
+In the old implementation the line with <tt>C INFO</tt> would never be
executed.
+Now it is appended at the bottom of the other patterns for
<tt>kern.log</tt>.
+
+Thanks to Gregor Hoffleit for the patch!
+
diff --git a/ChangeLog b/ChangeLog
index 3d73105..ae2ee53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
* 2352 FIX: FreeBSD Agent: Removed statgrab cpu section because there is a dedicated
cpu section...
* 2359 FIX: adva_fsp_if: Use more reliable SNMP table, avoids sporadic problems...
* 2360 FIX: esx_vsphere_vm.snapshot: Fix output of snapshot age in performance data
and graph...
+ * 2362 FIX: mk_logwatch: fix cases where one logfile is listsed more than once in
logwatch.cfg...
Multisite:
* 2314 FIX: Availability: fixed exception when grouping by host or service group
diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch
index afb334b..efbb40e 100755
--- a/agents/plugins/mk_logwatch
+++ b/agents/plugins/mk_logwatch
@@ -333,6 +333,7 @@ except Exception, e:
status = {}
+logfile_patterns = {}
# The filename line may contain options like 'maxlines=100' or
'maxtime=10'
for filenames, patterns in config:
# Initialize options with default values
@@ -385,7 +386,10 @@ for filenames, patterns in config:
print '[[[%s:missing]]]' % glob_pattern
else:
for logfile in logfiles:
- process_logfile(logfile, patterns)
+ logfile_patterns[logfile] = logfile_patterns.get(logfile, []) + patterns
+
+for logfile, patterns in logfile_patterns.items():
+ process_logfile(logfile, patterns)
if not debug:
save_status(status)