Skip to content

Commit 6db7162

Browse files
Merge pull request #45 from plaintextpackets/speedtest
Speedtest
2 parents 35406f7 + 0cd86ca commit 6db7162

File tree

11 files changed

+548
-90
lines changed

11 files changed

+548
-90
lines changed

.env

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@ threshold_latency = "100" # 100ms latency threshold as max
3939
threshold_jitter = "30" # 30ms jitter threshold as max
4040
threshold_dns_latency = "100" # 100ms dns latency threshold as max
4141

42+
# Speetest configuration (be very careful when running on a metered connection!)
43+
# - This configuration is for setting up a "speed test" or rather a test of your internet bandwidth.
44+
# - In order to test your upload and download bandwidth we use speedtest.net as source. So your client will connect there and upload and download some data.
45+
# - That also means that a random server is selected for the test (usually the nearest one)
46+
# - Setting the SPEEDTEST_INTERVAL too agressively will cause speedtest.net to block your requests, recommend 15 minutes (900 seconds) and above
47+
SPEEDTEST_ENABLED="True" # set this to "True" to enable speed test function
48+
SPEEDTEST_INTERVAL="937" # interval on which the speedtest will run, in seconds - note using a prime number helps reduce the number of collisions between netprobe and speed tests
4249

4350

4451
# SYSTEM VARIABLES - DO NOT TOUCH
4552

46-
DEVICE_ID="44c42e36-f2eb-44d0-babc-1a749498e016"
47-
SITE_ID="f0ac2f33-1a20-471d-b430-d905900e0e71"
48-
4953
PRESENTATION_PORT = "5000"
5054
PRESENTATION_INTERFACE = "0.0.0.0"
5155

README.md

Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Netprobe Lite
1+
# Netprobe
22

3-
Simple and effective tool for measuring ISP performance at home. The tool measures several performance metrics including packet loss, latency, jitter, and DNS performance. It also aggregates these metrics into a common score, which you can use to monitor overall health of your internet connection.
3+
Simple and effective tool for measuring ISP performance at home. The tool measures several performance metrics including packet loss, latency, jitter, and DNS performance. It also has an optional speed test to measure bandwidth. Netprobe aggregates these metrics into a common score, which you can use to monitor overall health of your internet connection.
44

55
## Support the Project
66

@@ -17,14 +17,16 @@ https://youtu.be/Wn31husi6tc
1717

1818
## Requirements and Setup
1919

20-
To run Netprobe Lite, you'll need a PC running Docker connected directly to your ISP router. Specifically:
20+
To run Netprobe, you'll need a PC running Docker connected directly to your ISP router. Specifically:
2121

22-
1. Netprobe Lite requires the latest version of Docker. For instructions on installing Docker, see YouTube, it's super easy.
22+
1. Netprobe requires the latest version of Docker. For instructions on installing Docker, see YouTube, it's super easy.
2323

24-
2. Netprobe Lite should be installed on a machine (the 'probe') which has a wired Ethernet connection to your primary ISP router. This ensures the tests are accurately measuring your ISP performance and excluding and interference from your home network. An old PC with Linux installed is a great option for this.
24+
2. Netprobe should be installed on a machine (the 'probe') which has a wired Ethernet connection to your primary ISP router. This ensures the tests are accurately measuring your ISP performance and excluding and interference from your home network. An old PC with Linux installed is a great option for this.
2525

2626
## Installation
2727

28+
### First-time Install
29+
2830
1. Clone the repo locally to the probe machine:
2931

3032
```
@@ -43,12 +45,46 @@ docker compose up
4345
docker compose down
4446
```
4547

48+
### Upgrading Between Versions
49+
50+
When upgrading between versions, it is best to delete the deployment altogether and restart with the new code. The process is described below.
51+
52+
1. Stop Netprobe in Docker and use the -v flag to delete all volumes (warning this deletes old data):
53+
54+
```
55+
docker compose down -v
56+
```
57+
58+
2. Clone the latest code (or download manually from Github and replace the current files):
59+
60+
```
61+
git clone https://github.com/plaintextpackets/netprobe_lite.git
62+
```
63+
64+
3. Re-start Netprobe:
65+
66+
```
67+
docker compose up
68+
```
69+
4670
## How to use
4771

4872
1. Navigate to: http://x.x.x.x:3001/d/app/netprobe where x.x.x.x = IP of the probe machine running Docker.
4973

5074
2. Default user / pass is 'admin/admin'. Login to Grafana and set a custom password.
5175

76+
## How to customize
77+
78+
### Enable Speedtest
79+
80+
By default the speed test feature is disabled as many users pay for bandwidth usage (e.g. cellular connections). To enable it, edit the .env file to set the option to 'True':
81+
82+
```
83+
SPEEDTEST_ENABLED="True"
84+
```
85+
86+
Note: speedtest.net has a limit on how frequently you can connection and run the test. If you set the test to run too frequently, you will receive errors. Recommend leaving the 'SPEEEDTEST_INTERVAL' unchanged.
87+
5288
### Change Netprobe port
5389

5490
To change the port that Netprobe Lite is running on, edit the 'compose.yml' file, under the 'grafana' section:
@@ -72,23 +108,41 @@ DNS_NAMESERVER_4_IP="8.8.8.8" # Replace this IP with the DNS server you use at h
72108

73109
Change 8.8.8.8 to the IP of the DNS server you use, then restart the application (docker compose down / docker compose up)
74110

111+
### Use external Grafana
112+
113+
Some users have their own Grafana instance running and would like to ingest Netprobe statistics there rather than running Grafana in Docker. To do this:
114+
115+
1. In the compose.yaml file, add a port mapping to the Prometheus deployment config:
116+
117+
```
118+
prometheus:
119+
...
120+
ports:
121+
- 'XXXX:9090'
122+
```
123+
... where XXXX is the port you wish to expose Prometheus on your host machine
124+
125+
2. Remove all of the Grafana configuration from the compose.yaml file
126+
127+
3. Run Netprobe and then add a datasource to your existing Grafana as http://x.x.x.x:XXXX where x.x.x.x = IP of the probe machine running Docker
128+
75129
### Data storage - default method
76130

77131
By default, Docker will store the data collected in several Docker volumes, which will persist between restarts.
78132

79133
They are:
80134

81135
```
82-
netprobe_lite_grafana_data (used to store Grafana user / pw)
83-
netprobe_lite_prometheus_data (used to store time series data)
136+
netprobe_grafana_data (used to store Grafana user / pw)
137+
netprobe_prometheus_data (used to store time series data)
84138
```
85139

86140
To clear out old data, you need to stop the app and remove these volumes:
87141

88142
```
89143
docker compose down
90-
docker volume rm netprobe_lite_grafana_data
91-
docker volume rm netprobe_lite_prometheus_data
144+
docker volume rm netprobe_grafana_data
145+
docker volume rm netprobe_prometheus_data
92146
```
93147

94148
When started again the old data should be wiped out.
@@ -144,13 +198,22 @@ mkdir -p data/grafana data/prometheus
144198

145199
### Run on startup
146200

147-
To configure the tool to work as a daemon (run on startup, keep running), edit 'compose.yml' and add the following to each service:
201+
Netprobe will automatically restart itself after the host system is rebooted, provided that Docker is also launched on startup. If you want to disable this behavior, modify the 'restart' variables in the compose.yaml file to this:
202+
203+
```
204+
restart: never
205+
```
206+
207+
### Wipe all stored data
208+
209+
To wipe all stored data and remove the Docker volumes, use this command:
148210

149211
```
150-
restart: always
212+
docker compose down -v
151213
```
214+
This will delete all containers and volumes related to Netprobe.
215+
152216

153-
More information can be found in the Docker documentation.
154217

155218
## FAQ & Troubleshooting
156219

compose.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,51 @@ services:
1414
- ./config/redis/redis.conf:/etc/redis/redis.conf
1515
networks:
1616
- netprobe-net
17+
dns:
18+
- 8.8.8.8
19+
- 8.8.4.4
1720

1821
netprobe:
1922
restart: always
2023
container_name: netprobe-probe
21-
image: "plaintextpackets/netprobe:latest"
24+
image: "plaintextpackets/netprobe:speedtest"
2225
volumes:
2326
- .:/netprobe_lite
2427
environment:
2528
MODULE: "NETPROBE"
2629
networks:
2730
- netprobe-net
31+
dns:
32+
- 8.8.8.8
33+
- 8.8.4.4
34+
35+
speedtest:
36+
restart: always
37+
container_name: netprobe-speedtest
38+
image: "plaintextpackets/netprobe:speedtest"
39+
volumes:
40+
- .:/netprobe_lite
41+
environment:
42+
MODULE: "SPEEDTEST"
43+
networks:
44+
- netprobe-net
45+
dns:
46+
- 8.8.8.8
47+
- 8.8.4.4
2848

2949
presentation:
3050
restart: always
3151
container_name: netprobe-presentation
32-
image: "plaintextpackets/netprobe:latest"
52+
image: "plaintextpackets/netprobe:speedtest"
3353
volumes:
3454
- .:/netprobe_lite
3555
environment:
3656
MODULE: "PRESENTATION"
3757
networks:
3858
- netprobe-net
59+
dns:
60+
- 8.8.8.8
61+
- 8.8.4.4
3962

4063
prometheus:
4164
restart: always
@@ -49,6 +72,9 @@ services:
4972
- '--storage.tsdb.path=/prometheus'
5073
networks:
5174
- netprobe-net
75+
dns:
76+
- 8.8.8.8
77+
- 8.8.4.4
5278

5379
grafana:
5480
restart: always
@@ -63,6 +89,9 @@ services:
6389
- '3001:3000'
6490
networks:
6591
- netprobe-net
92+
dns:
93+
- 8.8.8.8
94+
- 8.8.4.4
6695

6796
volumes:
6897
prometheus_data:

config/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class Config_Netprobe():
1515
probe_interval = int(os.getenv('PROBE_INTERVAL'))
1616
probe_count = int(os.getenv('PROBE_COUNT'))
1717
sites = os.getenv('SITES').split(',')
18-
device_id = os.getenv('DEVICE_ID')
19-
site_id = os.getenv('SITE_ID')
2018
dns_test_site = os.getenv('DNS_TEST_SITE')
19+
speedtest_enabled = os.getenv("SPEEDTEST_ENABLED", 'False').lower() in ('true', '1', 't')
20+
speedtest_interval = int(os.getenv('SPEEDTEST_INTERVAL'))
2121

2222
DNS_NAMESERVER_1 = os.getenv('DNS_NAMESERVER_1')
2323
DNS_NAMESERVER_1_IP = os.getenv('DNS_NAMESERVER_1_IP')

0 commit comments

Comments
 (0)