allow dropping of hosts
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# $Id: hbd,v 1.31 2012/06/16 14:18:26 andreas Exp $
|
# $Id: hbd,v 1.32 2012/09/22 17:51:16 andreas Exp $
|
||||||
# Wait for heartbeat messages and act on them (or their absence)
|
# Wait for heartbeat messages and act on them (or their absence)
|
||||||
#
|
#
|
||||||
import time, os, string, sys, socket, atexit, select, SocketServer, getopt, signal, cPickle, smtplib, traceback
|
import time, os, string, sys, socket, atexit, select, SocketServer, getopt, signal, cPickle, smtplib, traceback
|
||||||
@@ -570,6 +570,7 @@ interval=INTERVAL
|
|||||||
grace=GRACE
|
grace=GRACE
|
||||||
reportstrict=False
|
reportstrict=False
|
||||||
watchhosts=[]
|
watchhosts=[]
|
||||||
|
drophosts=[]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f=open(configfile,"r")
|
f=open(configfile,"r")
|
||||||
@@ -603,6 +604,8 @@ if f:
|
|||||||
reportstrict=r[1] in ["True","true","TRUE","1"]
|
reportstrict=r[1] in ["True","true","TRUE","1"]
|
||||||
elif r[0] == 'watchhosts':
|
elif r[0] == 'watchhosts':
|
||||||
watchhosts=eval(r[1])
|
watchhosts=eval(r[1])
|
||||||
|
elif r[0] == 'drophosts':
|
||||||
|
drophosts=eval(r[1])
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if len(args) != 0:
|
if len(args) != 0:
|
||||||
@@ -620,7 +623,11 @@ if os.path.exists(PICKFILE):
|
|||||||
htab=pick.load()
|
htab=pick.load()
|
||||||
msgs=pick.load()
|
msgs=pick.load()
|
||||||
pickf.close()
|
pickf.close()
|
||||||
os.unlink(PICKFILE)
|
# os.unlink(PICKFILE)
|
||||||
|
for h in drophosts:
|
||||||
|
if hosts.has_key(h):
|
||||||
|
del hosts[h]
|
||||||
|
|
||||||
|
|
||||||
now=time.time()
|
now=time.time()
|
||||||
startsec=int(now) % interval
|
startsec=int(now) % interval
|
||||||
|
|||||||
Reference in New Issue
Block a user