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
LABEL maintainer="Aiden Gilmartin" \
description="Speedtest to InfluxDB data bridge"
LABEL maintainer="Josh Smith" \
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
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update

View File

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