From: Stephen Soltesz Date: Mon, 5 Nov 2007 17:16:28 +0000 (+0000) Subject: collects all nodes associated with a list of loginbase patterns X-Git-Tag: Monitor-1.0-0~46 X-Git-Url: http://git.onelab.eu/?p=monitor.git;a=commitdiff_plain;h=ebe058d99f235de56d33f50350bb706f429e31e5 collects all nodes associated with a list of loginbase patterns --- diff --git a/get_metasite_nodes.py b/get_metasite_nodes.py new file mode 100755 index 0000000..5d88377 --- /dev/null +++ b/get_metasite_nodes.py @@ -0,0 +1,39 @@ +#!/usr/bin/python +import plc +import soltesz +import string +import sys + +def main(): + meta_sites = ['canarie', 'rnp', 'jgn2', 'i2', 'tp', 'princetondsl', 'plcolo', 'wide'] + l_blacklist = [ "grouse.hpl.hp.com", "planet1.att.nodes.planet-lab.org"] + #l_blacklist = soltesz.dbLoad("l_blacklist") + l_sitelist = [] + count = 0 + # for each prefix above + for pre_loginbase in meta_sites: + print "getting sites from base %s*" % pre_loginbase + search_sites = plc.getSites({'login_base' : pre_loginbase + "*"}) + # for each of the sites that begin with this prefix + for site in search_sites: + # get the nodes for that site + l_sitelist.append(site['login_base']) + print "%s : " % site['login_base'] + nodes = plc.getSiteNodes2(site['login_base']) + for node in nodes: + hn = node['hostname'] + if hn not in l_blacklist: + print "\t%s" % hn + count += 1 + # add the nodes to the blacklist + l_blacklist.append(hn) + #else: + # print "not adding %s" % hn + print string.join(l_sitelist, ",") + print "Found %d nodes" % count + print "Found %d sites " % len(l_sitelist) + + soltesz.dbDump("l_blacklist") + +if __name__=="__main__": + main()