Forked from: https://github.com/Roadeo/qbittorrent-peers-location-grafana
A python script (along with instructions) to display the locations of all the peers your qBittorrent client is connected to in a Grafana worldmap dashboard.
The following instructions are assuming:
- Docker is already running and configured
- Grafana is already running and configured
git clone https://github.com/kaizensh/qbit-peers && cd qbit-peers
- Create a data directory in the cloned repository
- Download the IP2Location LITE database from https://lite.ip2location.com/database/ip-country-region-city-latitude-longitude
- Extract the CSV file from the ZIP file and place it in the data directory
docker-compose.yml
- Change /opt/qbit-peers to your desired location
- Change the password for the MariaDB root user
qbit-peers.py
- Configure the qbittorrent server ip, port, username and password
- Configure the MariaDB host, port, user, password and database name
docker-compose up -d
Stop the qbit-peers container to avoid any potential issues before importing the IP2Location database
docker stop qbit-peers
IP2LOCATION-LITE-DB5.CSV
docker exec -it qbit-peers-mariadb mariadb -uroot -p<password>
USE ip2location;
LOAD DATA LOCAL INFILE '/tmp/IP2LOCATION-LITE-DB5.CSV'
INTO TABLE ip2location_db5
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n';
EXIT;
docker start qbit-peers
In Grafana, go to Connections > Data Sources > Add new source > MySQL
- Name:
qbit-peers-mariadb
- Host:
qbit-peers-mariadb
- Database:
ip2location
- User:
root
- Password:
<password>
Save & Test
Install the Worldmap Panel plugin: https://grafana.com/grafana/plugins/grafana-worldmap-panel/
- Add a new Panel
- Change Visualization to Worldmap Panel
- Change the Datasource to qbit-peers-mariadb
- Change the Format to Table
- Change the Dataset to ip2location
- Change the Table to peer_list
- Change the Column value to geohash
- Change the Min circle size to 1 (or your desired size)
- Change the Max circle size to 1 (or your desired size)
- Change the Location data to geohash
- Change the Field mapping to geohash