allow dropping of hosts
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/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)
|
||||
#
|
||||
import time, os, string, sys, socket, atexit, select, SocketServer, getopt, signal, cPickle, smtplib, traceback
|
||||
@@ -570,6 +570,7 @@ interval=INTERVAL
|
||||
grace=GRACE
|
||||
reportstrict=False
|
||||
watchhosts=[]
|
||||
drophosts=[]
|
||||
|
||||
try:
|
||||
f=open(configfile,"r")
|
||||
@@ -603,6 +604,8 @@ if f:
|
||||
reportstrict=r[1] in ["True","true","TRUE","1"]
|
||||
elif r[0] == 'watchhosts':
|
||||
watchhosts=eval(r[1])
|
||||
elif r[0] == 'drophosts':
|
||||
drophosts=eval(r[1])
|
||||
f.close()
|
||||
|
||||
if len(args) != 0:
|
||||
@@ -620,7 +623,11 @@ if os.path.exists(PICKFILE):
|
||||
htab=pick.load()
|
||||
msgs=pick.load()
|
||||
pickf.close()
|
||||
os.unlink(PICKFILE)
|
||||
# os.unlink(PICKFILE)
|
||||
for h in drophosts:
|
||||
if hosts.has_key(h):
|
||||
del hosts[h]
|
||||
|
||||
|
||||
now=time.time()
|
||||
startsec=int(now) % interval
|
||||
|
||||
Reference in New Issue
Block a user