Skip to content

Commit

Permalink
Merge pull request #20 from MiguelNdeCarvalho/port
Browse files Browse the repository at this point in the history
Add port env
  • Loading branch information
MiguelNdeCarvalho authored Oct 12, 2020
2 parents ff8f543 + a99e5df commit 37196e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ The following environment variables configure the exporter:

* `SPEEDTEST_SERVER`
Custom server ID from Speedtest server list like [https://telcodb.net/explore/speedtest-servers/](https://telcodb.net/explore/speedtest-servers/)

* `SPEEDTEST_PORT`
Port where metrics will be exposed. **Default:**`9800`
6 changes: 5 additions & 1 deletion src/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def run(http_port, sleep_time):
ping = Gauge('speedtest_ping_latency_milliseconds', 'Speedtest current Ping in ms')
download_speed = Gauge('speedtest_download_bits_per_second', 'Speedtest current Download Speed in bit/s')
upload_speed = Gauge('speedtest_upload_bits_per_second', 'Speedtest current Upload speed in bits/s')
PORT=9800
server_port = os.environ.get('SPEEDTEST_PORT')
if server_port:
PORT=int(server_port)
else:
PORT=9800
SLEEP=95
run(PORT, SLEEP)

0 comments on commit 37196e8

Please sign in to comment.