Module: check_mk
Branch: master
Commit: ec08b644bc4dbe5b04c7e5e19f9400581c51c016
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ec08b644bc4dbe…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Mar 25 11:15:13 2011 +0100
FIX: mk_logwatch: dont use readlines(), save RAM
---
ChangeLog | 1 +
agents/plugins/mk_logwatch | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ed30b95..c4a1994 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,7 @@
* FIX: cmctc: add scan function
* FIX: ucd_cpu_load and ucd_cpu_util: make scan function find Rittal
* FIX: ucd_cpu_util: fix check in case of missing hi, si and st
+ * FIX: mk_logwatch: improve implementation in order to save RAM
* printer_supply: Changed order of tests. When a printer reports -3 this
is used before the check if maxlevel is -2.
* printer_supply: Skipping inventory of supplies which have current value
diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch
index 567aae7..462054c 100755
--- a/agents/plugins/mk_logwatch
+++ b/agents/plugins/mk_logwatch
@@ -102,7 +102,7 @@ def read_config():
# /var/test/x12134.log|12345|32444355
def read_status():
status = {}
- for line in file(status_filename).readlines():
+ for line in file(status_filename):
# TODO: Remove variants with spaces. rsplit is
# not portale. split fails if logfilename contains
# spaces
@@ -179,7 +179,7 @@ def process_logfile(logfile, patterns):
f = os.fdopen(fl)
worst = 0
outputtxt = ""
- for line in f.readlines():
+ for line in f:
level = "."
for lev, pattern in patterns:
if pattern.search(line[:-1]):