This is a guide on how to monitor the quality of your ISP using InfluxDB and Telegraf.
Have you ever asked yourselve if internet is working properlly 🤔? Or without internet and waiting for it to come alive once again 🙇♂️? This setup will give you information of the quality and reliability of your ISP 😎. Oh, and did I mention Alerts 🚨when ISP is down or back online?
The goal is to setup an local Agent, running in your home 🏡, and make it report all that data to be monitored.
The default configuration of the Agent will ping every 10 seconds to google.com
and 8.8.8.8
. It will also measure DNS resolution to google.com
domain using 8.8.8.8
and 1.1.1.1
DNS Servers.
There are three different alternatives to deploy this stack
Requirements | Metrics | Notifications | Ease of Install | Remote Monitoring | |
---|---|---|---|---|---|
InfluxDB Free Tier | Raspberry Pi or similar | ✅ | ✅ | Easy | ✅ |
Standalone | Raspberry Pi or similar | ✅ | ❌ | Medium | ❌ Unless exposed |
Self Hosting | Raspberry Pi or similar + Cloud Hosting, VPS or similar | ✅ | ✅ | Difficult | ✅ |
Using Influxdata Free Tier as the managed cloud solution that combines InfluxDB + Grafana. And Telegraf in Raspberry Pi at your home.
- Create a Influxdb Cloud account
- Select Provider & Region (Maybe the one with a region near your location)
- Enter Company Name
- Click Next
- Choose Free Plan
- Open your Influxdb Account
- On the sidebar. Settings > Templates
- Paste URL of Template https://raw.githubusercontent.com/sbehrends/isp-monitor/main/isp-monitor-influxdata-template.yml
- Click Lookup Tempalte
- Click Install Template
- Click on Alerts
- Modify "Notification Endpoint" > "Webhook" with your own URL
For reporting ISP Status we now require an Agent or Client that will run in your local network and report ISP status to InfluxDB.
This agent can be running on a Raspberry Pi, NAS or similar, and requires Telegraf to be installed.
- Get Telegraf configuration
- Click on Load Data > Telegraf
- Click on Setup Instructions under Network Monitor
- Click on Create New Token and use it for later configuration
- Use command from Telegraf Setup Instructions step 3
Under Telegraf Setup Instructions, you will find several alterantives to install Telegraf Agent. Keep in mind that $INFLUX_HOST; $INFLUX_TOKEN; $INFLUX_ORG
are enviroment variables required by the Telegraf configuration provided.
- INFLUX_HOST: Is the URL of influxdata in your region. You can grab it from the URL in the browser
- INFLUX_TOKEN: Token generated in previous step
- INFLUX_ORG: Visible on top-left. By default is your email.
docker run -d --name=isp-monitor \
--restart=always \
-e INFLUX_TOKEN=REPLACE_TOKEN_FROM_STEP_ABOVE \
-e INFLUX_HOST=https://REPLACE_YOUR_REGION.cloud2.influxdata.com/ \
-e INFLUX_ORG=REPLACE_YOUR_ORG \
telegraf \
telegraf --config https://PASTE_URL_FROM_STEP_ABOVE
# docker-compose.yml
version: "2"
services:
telegraf:
image: telegraf
restart: always
command: telegraf --config https://PASTE_URL_FROM_STEP_ABOVE
environment:
INFLUX_TOKEN: REPLACE_TOKEN_FROM_STEP_ABOVE
INFLUX_HOST: https://REPLACE_YOUR_REGION.cloud2.influxdata.com/
INFLUX_ORG: REPLACE_YOUR_ORG
Deploy Telegraf, InfluxDB and Granfana all in the same host, for example all in a Raspberry Pi running at your home.
Follow this repo as reference of this setup.
Deploy InfluxDB and Grafana on a Virtual Private Server, or similar cloud hosting. And Telegraf in Raspberry Pi at your home.
This is my personal current setup. I have not documented it all yet, but includes InfluxDB, Grafana and Let's Encrypt certs running in docker in a VPS. Besides Telegraf Agent there is a NodeJS service to measure Internet Speed (using speedtest-net) and Modem Signal Level (Only available for ISP Fibertel, Argentina).
Reference script is available in self-hosted
folder.
I recommend Balena to orchestrate and deploy Raspberry Pi's with Telegraf agent. In my current setup I have 4 Raspberry Pi's managed by Balena reporting to my Self Hosted Influx + Grafana.