This commit is contained in:
andreas
2005-07-20 14:03:46 +00:00
parent 203f92d61f
commit 2a4be86179
3 changed files with 12 additions and 20 deletions
+9 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# $Id: hbd,v 1.2 2005/07/19 20:31:05 andreas Exp $
# $Id: hbd,v 1.3 2005/07/20 14:03:46 andreas Exp $
# Wait for heartbeat messages and act on them (or their absence)
#
import time, os, string, sys, socket, curses, atexit, select, SocketServer, getopt
@@ -269,6 +269,7 @@ def readsock():
name="unknown"
msg=None
interval=0
deltaT=0.0
for pair in pairs:
l=string.split(pair,"=")
key=l[0]
@@ -288,10 +289,15 @@ def readsock():
msg=val
elif key == 'service':
service=val
elif key == 'time':
try:
deltaT=now-float(val)
except:
pass
if boot:
log("%s booted" % name)
log("%s booted, deltaT %0.2g sec" % (name, deltaT))
if msg:
log("%s msg: %s" % (name, msg),service=service)
log("%s %0.2g msg: %s" % (name, deltaT, msg),service=service)
fromaddr(name, addr[0], boot, interval)
if shutdown:
log("%s shutdown" % name)