Module: check_mk
Branch: master
Commit: 99c9611d02241221d648024a2d1bba8e42b3dfb9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=99c9611d022412…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Mon Dec 12 14:36:35 2016 +0100
4102 FIX logwatch: Fixed crash due to non-existant logfile
In some cases, the logwatch check would crash trying to remove a logfile
that didn't exist anymore. This has been fixed.
Change-Id: Ia58ee607f766dd570aae7ceea53d672392ae153c
---
.werks/4102 | 11 +++++++++++
ChangeLog | 1 +
checks/logwatch | 2 +-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/4102 b/.werks/4102
new file mode 100644
index 0000000..5aaf3fe
--- /dev/null
+++ b/.werks/4102
@@ -0,0 +1,11 @@
+Title: logwatch: Fixed crash due to non-existant logfile
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i3
+Date: 1481549732
+
+In some cases, the logwatch check would crash trying to remove a logfile
+that didn't exist anymore. This has been fixed.
diff --git a/ChangeLog b/ChangeLog
index ccd1503..a988714 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,7 @@
* 4158 FIX: fileinfo: fixed file handling containing spaces
* 4101 FIX: citrix_sessions: Output error message in case of missing session
information....
* 4159 FIX: mem.win: fixed KeyError
+ * 4102 FIX: logwatch: Fixed crash due to non-existant logfile...
Multisite:
* 4070 Added a painter for the service check period
diff --git a/checks/logwatch b/checks/logwatch
index a6f39bd..2641060 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -571,7 +571,7 @@ def check_logwatch_generic(item, params, loglines, found,
groups=False):
logwatch_file.writelines(collect_block.output_lines)
# correct output size
logwatch_file.close()
- if net_lines == 0:
+ if net_lines == 0 and log_exists:
os.unlink(logfile)
# if logfile has reached maximum size, abort with critical state