removed bit conversions, forced packet loss to int

This commit is contained in:
breadlysm 2020-07-20 21:19:36 -04:00
parent ec879c7029
commit 1ef2c6e9f8
1 changed files with 4 additions and 3 deletions

View File

@ -47,7 +47,7 @@ def format_for_influx(cliout):
'time': data['timestamp'],
'fields': {
# Byte to Megabit
'bandwidth': data['download']['bandwidth'] / 125000,
'bandwidth': data['download']['bandwidth'], #/125000
'bytes': data['download']['bytes'],
'elapsed': data['download']['elapsed']
}
@ -57,7 +57,7 @@ def format_for_influx(cliout):
'time': data['timestamp'],
'fields': {
# Byte to Megabit
'bandwidth': data['upload']['bandwidth'] / 125000,
'bandwidth': data['upload']['bandwidth'], #/125000
'bytes': data['upload']['bytes'],
'elapsed': data['upload']['elapsed']
}
@ -66,7 +66,7 @@ def format_for_influx(cliout):
'measurement': 'packetLoss',
'time': data['timestamp'],
'fields': {
'packetLoss': data['packetLoss']
'packetLoss': int(data['packetLoss'])
}
}
]
@ -81,6 +81,7 @@ def main():
speedtest = subprocess.run(
["speedtest", "--accept-license", "--accept-gdpr", "-f", "json"], capture_output=True)
if speedtest.returncode == 0: # Speedtest was successful.
if speedtest.returncode == 0: # Speedtest was successful.
data = format_for_influx(speedtest.stdout)
print("Speedtest Successful:")