Module: check_mk
Branch: master
Commit: 6fc59ed1c26e77dff6ca07954b879a152a940c25
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6fc59ed1c26e77…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jul 5 10:08:40 2013 +0200
Change notify --keepalive protocol
---
modules/notify.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/modules/notify.py b/modules/notify.py
index 848c1c4..9102a46 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -349,8 +349,13 @@ def notify_keepalive():
g_notify_readahead_buffer = ""
config_timestamp = notify_config_timestamp()
+ # Send signal that we are ready to receive the next notification
+ sys.stdout.write("*")
+ sys.stdout.flush()
+
while True:
try:
+
# If the configuration has changed, we do a restart. But we do
# this check just before the next notification arrives. We must
# *not* read data from stdin, just peek! On the other hand we
@@ -375,7 +380,15 @@ def notify_keepalive():
if g_notify_readahead_buffer.startswith('\n\n'):
sys.exit(0)
while '\n\n' in g_notify_readahead_buffer:
- notify_notify()
+ try:
+ notify_notify()
+ except Exception, e:
+ if opt_debug:
+ raise
+ notify_log("ERROR %s\n%s" % (e, format_exception()))
+ sys.stdout.write("*")
+ sys.stdout.flush()
+
except Exception, e:
if opt_debug:
raise