command line test puller

This commit is contained in:
Dan Ballard 2012-04-08 09:29:53 -07:00
parent 4a7e34ed8a
commit 4a4eb6008d
1 changed files with 27 additions and 0 deletions

27
cmdline.py Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/python
import socket
import json
import time
while True:
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('', 6000))
data = sock.recv(10000)
sock.close()
#print data
stats = json.loads(data)
for stat in stats["Stats"]:
print "%s: %f" % (stat["type"] ,stat["value"])
print "----"
time.sleep(1)
except KeyboardInterrupt:
print "\nExiting..."
break
except:
print "\nError..."
break