use plccache, instead of directly loading pkl files
[monitor.git] / getnodekey.py
1 #!/usr/bin/python
2
3 import os
4 import sys
5 import string
6 import time
7 import moncommands
8 import plc
9
10 def main():
11
12         l_nodes = [ 'planetlab4.inf.ethz.ch', 'planetlab-1.di.fc.ul.pt',
13              'planetlab2.singaren.net.sg', 'planetlab2.nbgisp.com',
14              'planetlab1.koganei.wide.ad.jp', 'planetlab2.koganei.wide.ad.jp',
15              'planetlab1.citadel.edu', 'pl2.ucs.indiana.edu',
16              'plab1.engr.sjsu.edu', 'plab2.engr.sjsu.edu',
17              'planetlab1.iin-bit.com.cn', 'planetlab1.cs.virginia.edu',
18              'planetlab1.info.ucl.ac.be', 'node-1.mcgillplanetlab.org', ]
19         d_nodes = {}
20         for host in l_nodes:
21                 n = plc.getNodes({'hostname' : host})
22                 d_nodes[host] = n
23                 #print n
24
25         for host in d_nodes:
26                 ssh = moncommands.SSH('root', host)
27                 val = ssh.runE("grep NODE_KEY /tmp/planet.cnf")
28                 print "%s == %s" % (host, val)
29
30         
31 if __name__ == '__main__':
32         import os
33         try:
34                 main()
35         except Exception, error:
36                 print "Exception %s" % error
37                 sys.exit(0)