Module: check_mk
Branch: master
Commit: 2722732ae6104aa5181d2bcaa826920154a6da76
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2722732ae6104a…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Apr 14 11:58:23 2016 +0200
logwatch: fixed status 3 - unknown being reported if the logfile is empty
---
checks/logwatch | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/checks/logwatch b/checks/logwatch
index 0388b2a..a250d3c 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -260,15 +260,16 @@ def check_logwatch(item, params, info):
return 3, "Error in agent configuration: %s" % "
".join(info[0][4:])
found = False
+ right_block = False
loglines = []
for l in info:
node = l[0]
line = " ".join(l[1:])
if line == "[[[%s]]]" % item:
- found = True
+ found = right_block = True
elif len(line) > 6 and line[0:3] == "[[[" and line[-3:] ==
"]]]":
- found = False
- elif found and is_cache_new(node):
+ right_block = False
+ elif right_block and is_cache_new(node):
loglines.append(line)
return check_logwatch_generic(item, params, loglines, found)