Added nickname to Test
This commit is contained in:
parent
2f4829466d
commit
648b2b5fa7
8
main.py
8
main.py
@ -1,4 +1,6 @@
|
|||||||
# Sean Corrigan 2020
|
# Sean Corrigan 2020
|
||||||
|
# Script sends data to influx in bits/sec
|
||||||
|
|
||||||
import speedtest
|
import speedtest
|
||||||
import json
|
import json
|
||||||
from influxdb import InfluxDBClient
|
from influxdb import InfluxDBClient
|
||||||
@ -6,10 +8,10 @@ from influxdb import InfluxDBClient
|
|||||||
serverip = "192.168.0.13"
|
serverip = "192.168.0.13"
|
||||||
serverport = 8086
|
serverport = 8086
|
||||||
serverdatabase = "telegraf"
|
serverdatabase = "telegraf"
|
||||||
servernickname = 'PythonSpeedtest'
|
servernickname = 'Yoo01pn.ddns.net'
|
||||||
|
|
||||||
def speed(): # Actual Speedtest using speedtest-cli
|
def speed(): # Actual Speedtest using speedtest-cli
|
||||||
servers = [] # If you want to test against a specific server
|
servers = [] # If you want to test against a specific server eg.
|
||||||
threads = 4
|
threads = 4
|
||||||
# Choose the amount of threads to use for the test
|
# Choose the amount of threads to use for the test
|
||||||
test = speedtest.Speedtest()
|
test = speedtest.Speedtest()
|
||||||
@ -49,7 +51,7 @@ def uploadInfluxdata(host='192.168.0.13', port=8086): # Main upload section
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
#"time": "2009-11-10T23:00:00Z",
|
|
||||||
client = InfluxDBClient(host, port, database = serverdatabase) # Init connection to Influx Server
|
client = InfluxDBClient(host, port, database = serverdatabase) # Init connection to Influx Server
|
||||||
client.write_points(json_body) # Write Speedtest results
|
client.write_points(json_body) # Write Speedtest results
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user