Module: check_mk
Branch: master
Commit: 0c2d6c3ec331fa112f405290febe4b8fe794b748
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0c2d6c3ec331fa…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Sep 12 15:22:15 2014 +0200
#1399 FIX Fix left-over tac processes when showing Event Console history
When you show the Event Console history and run into a soft or hard
query limit (of usually 1,000 or 5,000 entries), then every time one
<tt>tac</tt> process was left over. This has been fixed.
---
.werks/1399 | 12 ++++++++++++
ChangeLog | 1 +
mkeventd/bin/mkeventd | 9 ++++-----
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/.werks/1399 b/.werks/1399
new file mode 100644
index 0000000..0a2f0ee
--- /dev/null
+++ b/.werks/1399
@@ -0,0 +1,12 @@
+Title: Fix left-over tac processes when showing Event Console history
+Level: 2
+Component: ec
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.5i6
+Date: 1410528075
+
+When you show the Event Console history and run into a soft or hard
+query limit (of usually 1,000 or 5,000 entries), then every time one
+<tt>tac</tt> process was left over. This has been fixed.
diff --git a/ChangeLog b/ChangeLog
index 452c646..b13a75c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -123,6 +123,7 @@
* 1148 Allow execution of actions when cancelling events...
* 1395 Event Console can now create notifications via Check_MK RBN...
* 1007 FIX: check_mkevents: fix case where events contain binary zeroes
+ * 1399 FIX: Fix left-over tac processes when showing Event Console history...
HW/SW-Inventory:
* 0643 windows inventory: OS now contains the install date, reg_uninstall now
contains the path...
diff --git a/mkeventd/bin/mkeventd b/mkeventd/bin/mkeventd
index 122f8a5..ee18dc5 100755
--- a/mkeventd/bin/mkeventd
+++ b/mkeventd/bin/mkeventd
@@ -577,14 +577,13 @@ def parse_history_file(path, headers, filters, greptexts, limit):
cmd = 'tac "%s"' % path
if greptexts:
cmd += ' | grep -i -e %s' % ".*".join(greptexts)
- grep = subprocess.Popen(cmd, shell = True, close_fds=True, stdout=subprocess.PIPE)
- logfile = grep.stdout
+ grep = subprocess.Popen(cmd, shell=True, close_fds=True, stdout=subprocess.PIPE)
- for line in logfile:
+ for line in grep.stdout:
line_no += 1
if limit != None and len(entries) > limit:
- if greptexts:
- os.kill(grep.pid, 15)
+ grep.kill()
+ grep.wait()
break
try: