Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Speedtest-for-InfluxDB-and-Grafana
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
Speedtest-for-InfluxDB-and-Grafana
Commits
24ae221f
Commit
24ae221f
authored
6 years ago
by
Barry Carey
Browse files
Options
Downloads
Patches
Plain Diff
Add singlerun flag. Set server before each run to force ping to update
parent
6a716f3a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+67
-0
67 additions, 0 deletions
.gitignore
InfluxdbSpeedtest.py
+8
-5
8 additions, 5 deletions
InfluxdbSpeedtest.py
README.md
+5
-0
5 additions, 0 deletions
README.md
with
80 additions
and
5 deletions
.gitignore
0 → 100644
+
67
−
0
View file @
24ae221f
# 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
This diff is collapsed.
Click to expand it.
InfluxdbSpeedtest.py
+
8
−
5
View file @
24ae221f
...
@@ -46,10 +46,11 @@ class configManager():
...
@@ -46,10 +46,11 @@ class configManager():
class
InfluxdbSpeedtest
():
class
InfluxdbSpeedtest
():
def
__init__
(
self
,
config
=
None
):
def
__init__
(
self
,
config
=
None
,
single_run
=
False
):
self
.
config
=
configManager
(
config
=
config
)
self
.
config
=
configManager
(
config
=
config
)
self
.
output
=
self
.
config
.
output
self
.
output
=
self
.
config
.
output
self
.
single_run
=
single_run
self
.
influx_client
=
InfluxDBClient
(
self
.
influx_client
=
InfluxDBClient
(
self
.
config
.
influx_address
,
self
.
config
.
influx_address
,
self
.
config
.
influx_port
,
self
.
config
.
influx_port
,
...
@@ -62,7 +63,6 @@ class InfluxdbSpeedtest():
...
@@ -62,7 +63,6 @@ class InfluxdbSpeedtest():
self
.
speedtest
=
None
self
.
speedtest
=
None
self
.
results
=
None
self
.
results
=
None
self
.
setup_speedtest
()
def
setup_speedtest
(
self
):
def
setup_speedtest
(
self
):
...
@@ -81,7 +81,7 @@ class InfluxdbSpeedtest():
...
@@ -81,7 +81,7 @@ class InfluxdbSpeedtest():
print
(
'
ERROR: No matched servers: {}
'
.
format
(
self
.
config
.
test_server
[
0
]))
print
(
'
ERROR: No matched servers: {}
'
.
format
(
self
.
config
.
test_server
[
0
]))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
except
speedtest
.
ServersRetrievalError
:
except
speedtest
.
ServersRetrievalError
:
print
(
'
ERROR: Cannot retrieve speedtest server list
'
)
print
(
'
ERROR: Cannot retrieve speedtest
.net
server list
'
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
except
speedtest
.
InvalidServerIDType
:
except
speedtest
.
InvalidServerIDType
:
print
(
'
{} is an invalid server type, must be int
'
.
format
(
self
.
config
.
test_server
[
0
]))
print
(
'
{} is an invalid server type, must be int
'
.
format
(
self
.
config
.
test_server
[
0
]))
...
@@ -119,11 +119,13 @@ class InfluxdbSpeedtest():
...
@@ -119,11 +119,13 @@ class InfluxdbSpeedtest():
def
run
(
self
):
def
run
(
self
):
while
True
:
while
True
:
self
.
setup_speedtest
()
self
.
speedtest
.
download
()
self
.
speedtest
.
download
()
self
.
speedtest
.
upload
()
self
.
speedtest
.
upload
()
self
.
send_results
()
self
.
send_results
()
if
self
.
single_run
:
return
time
.
sleep
(
self
.
config
.
delay
)
time
.
sleep
(
self
.
config
.
delay
)
...
@@ -160,8 +162,9 @@ def main():
...
@@ -160,8 +162,9 @@ def main():
parser
=
argparse
.
ArgumentParser
(
description
=
"
A tool to send Plex statistics to InfluxDB
"
)
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
(
'
--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
()
args
=
parser
.
parse_args
()
collector
=
InfluxdbSpeedtest
(
config
=
args
.
config
)
collector
=
InfluxdbSpeedtest
(
config
=
args
.
config
,
single_run
=
args
.
singlerun
)
collector
.
run
()
collector
.
run
()
...
...
This diff is collapsed.
Click to expand it.
README.md
+
5
−
0
View file @
24ae221f
...
@@ -5,6 +5,11 @@
...
@@ -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
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
## Configuration within config.ini
#### GENERAL
#### GENERAL
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment