Module: check_mk
Branch: master
Commit: 7869f2d3dd7bb9af288c6537335ddd3020699fe9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7869f2d3dd7bb9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 18 15:03:05 2013 +0100
Logwatch: context lines can now be disabled using nocontext=1
Each line which comes together with a line matching a logwatch pattern
is proceeded to the monitoring host as context line. This can now be
disabled using the linux agent plugin by adding the option "nocontext=1"
to the header line of a logfile configuration in logwatch.cfg
---
.werks/214 | 11 +++++++++++
ChangeLog | 1 +
agents/plugins/mk_logwatch | 5 +++++
3 files changed, 17 insertions(+)
diff --git a/.werks/214 b/.werks/214
new file mode 100644
index 0000000..30d8ab0
--- /dev/null
+++ b/.werks/214
@@ -0,0 +1,11 @@
+Title: Logwatch: context lines can now be disabled using nocontext=1
+Level: 1
+Component: checks
+Version: 1.2.3i7
+Date: 1384783276
+Class: feature
+
+Each line which comes together with a line matching a logwatch pattern
+is proceeded to the monitoring host as context line. This can now be
+disabled using the linux agent plugin by adding the option "nocontext=1"
+to the header line of a logfile configuration in logwatch.cfg
diff --git a/ChangeLog b/ChangeLog
index 0573e06..e8d4e8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@
* 0093 check_http: Default service description prefix can be avoided...
* 0004 df: dynamic filesystem levels now reorder levels automatically...
* 0069 veeam_client: limits for time since last backup introduced
+ * 0214 Logwatch: context lines can now be disabled using nocontext=1...
* 0024 FIX: cisco_wlc: removed configuration parameter ap_model
* 0065 FIX: veeam_client: check behaviour improved when backup is in progress
* 0066 FIX: veeam_jobs: check behaviour improved when backup is in progress
diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch
index 6cd4e3f..3dbca32 100755
--- a/agents/plugins/mk_logwatch
+++ b/agents/plugins/mk_logwatch
@@ -293,6 +293,8 @@ def process_logfile(logfile, patterns):
line = line.replace("\1", "\nCONT:")
if level == "I":
level = "."
+ if opt_nocontext and level == '.':
+ continue
outputtxt += "%s%s %s%s\n" % (color, level, line[:-1], tty_normal)
new_offset = os.lseek(fl, 0, 1) # os.SEEK_CUR not available in Python 2.4
@@ -328,6 +330,7 @@ for filenames, patterns in config:
opt_regex = None
opt_overflow = 'C'
opt_overflow_level = 2
+ opt_nocontext = False
try:
options = [ o.split('=', 1) for o in filenames if '=' in o ]
for key, value in options:
@@ -344,6 +347,8 @@ for filenames, patterns in config:
opt_regex = re.compile(value)
elif key == 'iregex':
opt_regex = re.compile(value, re.I)
+ elif key == 'nocontext':
+ opt_nocontext = True
else:
raise Exception("Invalid option %s" % key)
except Exception, e: