From 22016285e3b986d36d77708e1257ac2206c30939 Mon Sep 17 00:00:00 2001 From: andreas Date: Sat, 22 Sep 2012 17:51:16 +0000 Subject: [PATCH] allow dropping of hosts --- hbd | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hbd b/hbd index 4573f8a..69ad957 100755 --- a/hbd +++ b/hbd @@ -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