Private GIT

Skip to content
Snippets Groups Projects
Unverified Commit 9a92a021 authored by Allan's avatar Allan Committed by GitHub
Browse files

Merge pull request #2 from barrycarey/master

Merge master of barrycarey into atribe to build new docker image
parents 045a3f60 24ae221f
Branches
No related tags found
No related merge requests found
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
venv
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
\ No newline at end of file
......@@ -46,10 +46,11 @@ class configManager():
class InfluxdbSpeedtest():
def __init__(self, config=None):
def __init__(self, config=None, single_run=False):
self.config = configManager(config=config)
self.output = self.config.output
self.single_run = single_run
self.influx_client = InfluxDBClient(
self.config.influx_address,
self.config.influx_port,
......@@ -62,7 +63,6 @@ class InfluxdbSpeedtest():
self.speedtest = None
self.results = None
self.setup_speedtest()
def setup_speedtest(self):
......@@ -81,7 +81,7 @@ class InfluxdbSpeedtest():
print('ERROR: No matched servers: {}'.format(self.config.test_server[0]))
sys.exit(1)
except speedtest.ServersRetrievalError:
print('ERROR: Cannot retrieve speedtest server list')
print('ERROR: Cannot retrieve speedtest.net server list')
sys.exit(1)
except speedtest.InvalidServerIDType:
print('{} is an invalid server type, must be int'.format(self.config.test_server[0]))
......@@ -119,11 +119,13 @@ class InfluxdbSpeedtest():
def run(self):
while True:
self.setup_speedtest()
self.speedtest.download()
self.speedtest.upload()
self.send_results()
if self.single_run:
return
time.sleep(self.config.delay)
......@@ -160,8 +162,9 @@ def main():
parser = argparse.ArgumentParser(description="A tool to send Plex statistics to InfluxDB")
parser.add_argument('--config', default='config.ini', dest='config', help='Specify a custom location for the config file')
parser.add_argument('--singlerun', action='store_true', help='Only runs through once, does not keep monitoring')
args = parser.parse_args()
collector = InfluxdbSpeedtest(config=args.config)
collector = InfluxdbSpeedtest(config=args.config, single_run=args.singlerun)
collector.run()
......
......@@ -5,6 +5,11 @@
This tool is a wrapper for speedtest-cli which allows you to run periodic speedtets and save the results to Influxdb
## Command Line Args
--config whatever.ini - Use a different ini file
--singlerun - Run once and exit
## Configuration within config.ini
#### GENERAL
......@@ -50,7 +55,7 @@ You will need the speedtest-cli library installed to use this - [Found Here](htt
2. Make a directory to hold the config.ini file. Navigate to that directory and download the sample config.ini in this repo.
```bash
mkdir speedtest
curl -O https://raw.githubusercontent.com/barrycarey/Speedtest-for-InfluxDB-and-Grafana/blob/master/config.ini speedtest/config.ini
curl -O https://raw.githubusercontent.com/barrycarey/Speedtest-for-InfluxDB-and-Grafana/master/config.ini speedtest/config.ini
cd speedtest
```
......@@ -75,6 +80,6 @@ atribe/speedtest-for-influxdb-and-grafana
```
2. The docker-compose option
```bash
curl -O https://raw.githubusercontent.com/barrycarey/Speedtest-for-InfluxDB-and-Grafana/blob/master/docker-compose.yml docker-compose.yml
curl -O https://raw.githubusercontent.com/barrycarey/Speedtest-for-InfluxDB-and-Grafana/master/docker-compose.yml docker-compose.yml
docker-compose up -d
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment