Skip to content

Commit

Permalink
added rover's ip address to deepsream
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Stanley committed Jan 5, 2018
1 parent 0c9d162 commit 425bfc0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rover/core/servers/iftop/iftop.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
out, err = p.communicate()
uploadArr = re.findall(r"Total send rate:\s+(\d{1,}\.{0,1}\d{0,})(\w+)", out)
downloadArr = re.findall(r"Total receive rate:\s+(\d{1,}\.{0,1}\d{0,})(\w+)", out)
ipAddress = re.findall(r"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", out)[0]
upload = 0
download = 0
if uploadArr is not [] and downloadArr is not []:
Expand All @@ -29,10 +30,12 @@
upload = upload * 1000000
if downloadArr[0][1] == "Mb":
download = download * 1000000
print "Upload: {} {} Download: {} {}".format(upload, uploadArr[0][1], download , downloadArr[0][1])
post({"upload": upload, "download": download}, recordName)
print "Upload: {} {} Download: {} {} IP: {}".format(upload, uploadArr[0][1], download , downloadArr[0][1], ipAddress)
post({"upload": upload, "download": download, "ip": ipAddress}, recordName)
except:
try:
post({}, "speed")
print("No data from interface: " + interface)
sleep(1)
except:
print("cannot connect to deepstream.")

0 comments on commit 425bfc0

Please sign in to comment.