Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
speedtest-exporter-cli
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Varac
speedtest-exporter-cli
Commits
e7bef525
Commit
e7bef525
authored
7 years ago
by
Will Storer
Browse files
Options
Downloads
Patches
Plain Diff
initial commit
parents
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
Dockerfile
+13
-0
13 additions, 0 deletions
Dockerfile
Makefile
+13
-0
13 additions, 0 deletions
Makefile
run-speedtest.py
+34
-0
34 additions, 0 deletions
run-speedtest.py
with
60 additions
and
0 deletions
Dockerfile
0 → 100644
+
13
−
0
View file @
e7bef525
FROM
debian:latest
RUN
apt-get update
&&
apt-get
install
-y
\
python-pip
RUN
mkdir
/app
COPY
run-speedtest.py /app/
RUN
pip
install
speedtest-cli
RUN
pip
install
prometheus-client
EXPOSE
9104
ENTRYPOINT
["/app/run-speedtest.py"]
This diff is collapsed.
Click to expand it.
Makefile
0 → 100644
+
13
−
0
View file @
e7bef525
IMAGE_NAME
=
registry:5000/speedtest:0.1
build-image
:
docker build
-t
$(
IMAGE_NAME
)
.
push-image
:
docker push
$(
IMAGE_NAME
)
run-image
:
docker run
--rm
-it
--net
host
$(
IMAGE_NAME
)
run-shell
:
docker run
--rm
-it
--net
host
$(
IMAGE_NAME
)
/bin/bash
This diff is collapsed.
Click to expand it.
run-speedtest.py
0 → 100755
+
34
−
0
View file @
e7bef525
#!/usr/bin/python
import
speedtest
import
time
from
prometheus_client
import
start_http_server
,
Summary
,
Gauge
servers
=
[]
# If you want to test against a specific server
# servers = [1234]
s
=
speedtest
.
Speedtest
()
#results_dict = s.results.dict()
#print results_dict
g_download
=
Gauge
(
'
download_speed
'
,
'
Download speed
'
)
g_upload
=
Gauge
(
'
upload_speed
'
,
'
Upload speed
'
)
def
process_request
(
t
):
s
.
get_servers
(
servers
)
s
.
get_best_server
()
s
.
download
()
s
.
upload
()
results_dict
=
s
.
results
.
dict
()
g_download
.
set
(
results_dict
[
"
download
"
])
g_upload
.
set
(
results_dict
[
"
upload
"
])
time
.
sleep
(
t
)
if
__name__
==
'
__main__
'
:
# Start up the server to expose the metrics.
start_http_server
(
9104
)
# Generate some requests.
while
True
:
process_request
(
60
)
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