jeanralphaviles / prometheus_speedtest Goto Github PK
View Code? Open in Web Editor NEWInstrument Speedtest.net tests from Prometheus
License: Apache License 2.0
Instrument Speedtest.net tests from Prometheus
License: Apache License 2.0
Currently there's only the latest
tag, which prevents pinning a particular version. Please push tags according to this project git tags. Thanks !
Hello,
Currently the container is listening on ipv4 only.
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9516 0.0.0.0:* LISTEN 1/python
Other examples like the blackbox exporter are listening on both ipv4 and ipv6:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::9115 :::* LISTEN 1/blackbox_exporter
I'm using venv (python 3.8.1)
$ pip install prometheus_speedtest
$ prometheus_speedtest
Traceback (most recent call last):
File "/opt/exporters/speedtest/bin/prometheus_speedtest", line 11, in <module>
load_entry_point('prometheus-speedtest==0.9.2', 'console_scripts', 'prometheus_speedtest')()
File "/opt/exporters/speedtest/lib/python3.8/site-packages/prometheus_speedtest/prometheus_speedtest.py", line 137, in init
app.run(main)
File "/opt/exporters/speedtest/lib/python3.8/site-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/opt/exporters/speedtest/lib/python3.8/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "/opt/exporters/speedtest/lib/python3.8/site-packages/prometheus_speedtest/prometheus_speedtest.py", line 130, in main
logging.info('Starting HTTP server listening on %s:%s', FLAGS.address,
File "/opt/exporters/speedtest/lib/python3.8/site-packages/absl/logging/__init__.py", line 335, in info
log(INFO, msg, *args, **kwargs)
File "/opt/exporters/speedtest/lib/python3.8/site-packages/absl/logging/__init__.py", line 476, in log
_absl_logger.log(standard_level, msg, *args, **kwargs)
File "/opt/exporters/speedtest/lib/python3.8/site-packages/absl/logging/__init__.py", line 1038, in log
super(ABSLLogger, self).log(level, msg, *args, **kwargs)
File "/opt/python/3.8.1/lib/python3.8/logging/__init__.py", line 1500, in log
self._log(level, msg, args, **kwargs)
File "/opt/python/3.8.1/lib/python3.8/logging/__init__.py", line 1565, in _log
fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
seems to be related to #14
Hi,
First of all, thanks for the development of this useful module!
I noticed in my case, that the default Speedtest server used for the test is giving random results, not reflecting my broadband bandwidth reality. speedtest-cli has an option to force the test to run using a specific server:
--server SERVER Specify a server ID to test against. Can be supplied
multiple times
Could you implement this option into prometheus_speedtest?
Thanks!
Best,
Hi,
I have been running prometheus_speedtest successfully for about 3 months now (k3s on rpi4). Since ~4 days, I get the following stacktrace
2021-04-09T07:42:59.803021968Z stderr F I0409 07:42:59.800787 281473072405256 prometheus_speedtest.py:134] GET /probe HTTP/1.1 - ('10.42.0.40', 36952)
--
| 2021-04-09T07:42:59.803116225Z stderr F I0409 07:42:59.802088 281473072405256 prometheus_speedtest.py:58] Performing Speedtest...
| 2021-04-09T07:47:59.804627911Z stderr F ----------------------------------------
| 2021-04-09T07:47:59.804765482Z stderr F Exception happened during processing of request from ('10.42.0.40', 36952)
| 2021-04-09T07:47:59.804811296Z stderr F Traceback (most recent call last):
| 2021-04-09T07:47:59.804841943Z stderr F File "/usr/local/lib/python3.7/socketserver.py", line 650, in process_request_thread
| 2021-04-09T07:47:59.804874016Z stderr F self.finish_request(request, client_address)
| 2021-04-09T07:47:59.804904886Z stderr F File "/usr/local/lib/python3.7/socketserver.py", line 360, in finish_request
| 2021-04-09T07:47:59.804957866Z stderr F self.RequestHandlerClass(request, client_address, self)
| 2021-04-09T07:47:59.804996588Z stderr F File "/prometheus_speedtest/prometheus_speedtest.py", line 125, in __init__
| 2021-04-09T07:47:59.805025383Z stderr F super().__init__(directory=static_directory, *args, **kwargs)
| 2021-04-09T07:47:59.80505779Z stderr F File "/usr/local/lib/python3.7/http/server.py", line 646, in __init__
| 2021-04-09T07:47:59.805086938Z stderr F super().__init__(*args, **kwargs)
| 2021-04-09T07:47:59.805116141Z stderr F File "/usr/local/lib/python3.7/socketserver.py", line 720, in __init__
| 2021-04-09T07:47:59.80514377Z stderr F self.handle()
| 2021-04-09T07:47:59.80517151Z stderr F File "/usr/local/lib/python3.7/http/server.py", line 426, in handle
| 2021-04-09T07:47:59.805198787Z stderr F self.handle_one_request()
| 2021-04-09T07:47:59.805231175Z stderr F File "/usr/local/lib/python3.7/http/server.py", line 414, in handle_one_request
| 2021-04-09T07:47:59.805259397Z stderr F method()
| 2021-04-09T07:47:59.805286989Z stderr F File "/prometheus_speedtest/prometheus_speedtest.py", line 137, in do_GET
| 2021-04-09T07:47:59.805314395Z stderr F prometheus_client.MetricsHandler.do_GET(self)
| 2021-04-09T07:47:59.805345987Z stderr F File "/usr/local/lib/python3.7/site-packages/prometheus_client/exposition.py", line 169, in do_GET
| 2021-04-09T07:47:59.805378413Z stderr F status, header, output = _bake_output(registry, accept_header, params)
| 2021-04-09T07:47:59.805406356Z stderr F File "/usr/local/lib/python3.7/site-packages/prometheus_client/exposition.py", line 40, in _bake_output
| 2021-04-09T07:47:59.805436504Z stderr F output = encoder(registry)
| 2021-04-09T07:47:59.805469299Z stderr F File "/usr/local/lib/python3.7/site-packages/prometheus_client/openmetrics/exposition.py", line 14, in generate_latest
| 2021-04-09T07:47:59.805497558Z stderr F for metric in registry.collect():
| 2021-04-09T07:47:59.805525002Z stderr F File "/usr/local/lib/python3.7/site-packages/prometheus_client/registry.py", line 82, in collect
| 2021-04-09T07:47:59.805581575Z stderr F for metric in collector.collect():
| 2021-04-09T07:47:59.805611333Z stderr F File "/prometheus_speedtest/prometheus_speedtest.py", line 92, in collect
| 2021-04-09T07:47:59.805690406Z stderr F results = self._tester.test()
| 2021-04-09T07:47:59.805721146Z stderr F File "/prometheus_speedtest/prometheus_speedtest.py", line 60, in test
| 2021-04-09T07:47:59.805747923Z stderr F timeout=self._timeout)
| 2021-04-09T07:47:59.805774478Z stderr F File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1091, in __init__
| 2021-04-09T07:47:59.805799774Z stderr F self.get_config()
| 2021-04-09T07:47:59.805825717Z stderr F File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1174, in get_config
| 2021-04-09T07:47:59.805851513Z stderr F map(int, server_config['ignoreids'].split(','))
| 2021-04-09T07:47:59.805877142Z stderr F ValueError: invalid literal for int() with base 10: ''
| 2021-04-09T07:47:59.805902938Z stderr F ----------------------------------------
I've cloned the sources, but I'm no python developer and the fix is not obvious to me (else I would have made a PR).
Hi,
Have set up the following via docker compose and tied into my current prometheus instance, Speedtest is able to run when not defining a specific server but fails to locate the local speedtest server which I used to use when defined as a command. The following error is present:
Note, the server ID I have 3448 which is a valid server in Manchester GB.
Thanks
Hi I am having trouble installing this package.
When I pip install prometheus-speedtest
, Iget an error like below.
# pip install prometheus-speedtest
Collecting prometheus-speedtest
Using cached prometheus_speedtest-0.9.12.tar.gz (18 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-mlwcyal3/prometheus-speedtest_01a01e8fd40c4c96aa6b198bf83288ae/setup.py", line 58, in <module>
extras_require={'dev': read_file('requirements-dev.txt')},
File "/tmp/pip-install-mlwcyal3/prometheus-speedtest_01a01e8fd40c4c96aa6b198bf83288ae/setup.py", line 18, in read_file
with open(os.path.join(here, rel_path), 'r', encoding='utf-8') as rel_file:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-mlwcyal3/prometheus-speedtest_01a01e8fd40c4c96aa6b198bf83288ae/requirements-dev.txt'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
It seems that requirements-dev.txt
file is not included in the package that pip downloades.
Hi,
is there a grafana dashboard template available for users to just import?
Maybe make it available here: https://grafana.com/grafana/dashboards
Best regards,
Florian
pi@pi:~ $ docker --version
Docker version 19.03.5, build 633a0ea
pi@pi:~ $ uname -a
Linux pi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux
pi@pi:~ $ docker run --rm -i --name prometheus_speedtest -p 9516:9516/tcp jraviles/prometheus_speedtest:latest
standard_init_linux.go:211: exec user process caused "exec format error"
I would love to run this on a Raspberry pi.. any chance for an ARM version?
Hello, not taking the metrics, did not work with docker.
Hi Jean-Ralph,
I tried your new image but the start fails with the following error.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/prometheus_speedtest/prometheus_speedtest.py", line 136, in
app.run(main)
File "/usr/local/lib/python3.8/site-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/usr/local/lib/python3.8/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "/prometheus_speedtest/prometheus_speedtest.py", line 130, in main
logging.info('Starting HTTP server listening on %s:%s', FLAGS.address,
File "/usr/local/lib/python3.8/site-packages/absl/logging/init.py", line 335, in info
log(INFO, msg, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/absl/logging/init.py", line 476, in log
_absl_logger.log(standard_level, msg, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/absl/logging/init.py", line 1038, in log
super(ABSLLogger, self).log(level, msg, *args, **kwargs)
File "/usr/local/lib/python3.8/logging/init.py", line 1500, in log
self._log(level, msg, args, **kwargs)
File "/usr/local/lib/python3.8/logging/init.py", line 1565, in _log
fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
Googling produce sth. similar here:
python 3.8 related?
Could you get your previous version back to docker hub please and tag it appropriately?
Thanks.
Peter
Like in title
Hi
I'm getting the following error when trying to run this on Alpine Linux v3.10or 3.11 (Python 3.7.5 or 3.8.1).
Traceback (most recent call last):
File "/usr/bin/prometheus_speedtest", line 11, in <module>
load_entry_point('prometheus-speedtest==0.9.1', 'console_scripts', 'prometheus_speedtest')()
TypeError: main() missing 1 required positional argument: 'argv'
I have tried installing via pip and easy_install, no change.
Cheers
Stephen
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.