Module: check_mk
Branch: master
Commit: 25fb5bf35a8ccb62039eea129f828c6279502587
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=25fb5bf35a8ccb…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 17 17:27:05 2013 +0100
FIX Trying to prevent problem when restarting mkeventd
In some situation, when restarting the mkeventd, the old process has
been stopped, but when the new process comes up, the builtin syslog
server can not open the port, because it is somehow still opened.
The error message is:
Cannot bind TCP socket for syslog-tcp to port: Address already in use
This change tries to prevent the problem.
---
.werks/384 | 17 +++++++++++++++++
ChangeLog | 1 +
mkeventd/bin/mkeventd | 8 +++++++-
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/.werks/384 b/.werks/384
new file mode 100644
index 0000000..1827a4a
--- /dev/null
+++ b/.werks/384
@@ -0,0 +1,17 @@
+Title: Trying to prevent problem when restarting mkeventd
+Level: 1
+Component: ec
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387297403
+Targetversion: future
+
+In some situation, when restarting the mkeventd, the old process has
+been stopped, but when the new process comes up, the builtin syslog
+server can not open the port, because it is somehow still opened.
+The error message is:
+
+Cannot bind TCP socket for syslog-tcp to port: Address already in use
+
+This change tries to prevent the problem.
diff --git a/ChangeLog b/ChangeLog
index a50f947..3ab8733 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -103,6 +103,7 @@
* 0304 FIX: Escaping several unwanted chars from incoming log messages...
* 0089 FIX: CSV export of event console was broken...
* 0359 FIX: Fixed exception in event simulator when one match group did not match
+ * 0384 FIX: Trying to prevent problem when restarting mkeventd...
Livestatus:
* 0337 New header for limiting the execution time of a query...
diff --git a/mkeventd/bin/mkeventd b/mkeventd/bin/mkeventd
index 940f2b6..1f11de9 100755
--- a/mkeventd/bin/mkeventd
+++ b/mkeventd/bin/mkeventd
@@ -2366,7 +2366,6 @@ def run_eventd():
time.sleep(1)
-
#.
# .--EventStatus---------------------------------------------------------.
# | _____ _ ____ _ _ |
@@ -3266,6 +3265,13 @@ try:
g_event_server.output_hash_stats()
+ # Closing fds which might be still open
+ for fd in [ opt_syslog_fd, opt_syslog_tcp_fd, opt_snmptrap_fd ]:
+ try:
+ os.close(fd)
+ except:
+ pass
+
log("Successfully shut down.")
os.remove(g_pid_file)
sys.exit(0)