fixed typos, errors with packetloss data

This commit is contained in:
Josh Smith 2020-07-30 18:53:20 -04:00
parent 61e60fb103
commit 829905d2cf
6 changed files with 327 additions and 328 deletions

View file

@ -1,8 +1,8 @@
FROM python:3.8-slim-buster FROM python:3.8-slim-buster
LABEL maintainer="Aiden Gilmartin" \ LABEL maintainer="Josh Smith" \
description="Speedtest to InfluxDB data bridge" description="Original by Aiden Gilmartin. Speedtest to InfluxDB data bridge"
#wget "https://ookla.bintray.com/download/$(wget https://ookla.bintray.com/download/ -q -O - | grep x86_64-linux.tgz\" | grep -Po "(?<=href=\")[^^\"]*" | cut -d ":" -f 2)"
# Install dependencies # Install dependencies
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update RUN apt-get update

View file

@ -2,7 +2,6 @@ import time
import json import json
import subprocess import subprocess
import os import os
from influxdb import InfluxDBClient from influxdb import InfluxDBClient
# InfluxDB Settings # InfluxDB Settings
@ -29,7 +28,7 @@ def init_db():
else: else:
influxdb_client.switch_database(DB_DATABASE) # Switch to if does exist. influxdb_client.switch_database(DB_DATABASE) # Switch to if does exist.
def pkt_loss(data): def pkt_loss(data):
if data['packetLoss']: if 'packetLoss' in data.keys():
return data['packetLoss'] return data['packetLoss']
else: else:
return 0 return 0