import repository from arizona
[raven.git] / owl / client / scripts.d / planetlab
1 #!/usr/bin/python
2
3 import os
4 import sys
5 from xmlrpclib import ServerProxy
6
7 print "[planetlab]"
8
9 nodemanager = ServerProxy('http://127.0.0.1:812/')
10
11 try:
12     rec = nodemanager.GetRecord()
13 except:
14     print "status=exception_GetRecord()"
15     sys.exit(0)
16
17 if (rec == None):
18     print "status=null_record"
19     sys.exit(0)
20
21 rspec = rec.get("_rspec", {})
22
23 if ((rspec == {}) or (rspec == None)):
24     print "status=empty_rspec"
25     sys.exit(0)
26
27 cpu_pct = rspec.get("cpu_pct", -1)
28 net_min_rate = rspec.get("net_min_rate", -1)
29
30 print "cpu_pct=" + str(cpu_pct)
31 print "net_min_rate=" + str(net_min_rate)
32 print "status=ok"