This app is a Prometheus exporter for qBittorrent. You must have version 4.1.0 of qBittorrent or higher.
I was using an excellent exporter written in Java and I wanted to learn Go, that's how I got the idea to rewrite the exporter in Go.
Additionally, this project adds support for tags and categories. It tracks the categories and tags of each torrent and the global categories and tags.
This app is a lightweight and fast prometheus exporter for qBittorrent, made to be integrated with the qbittorrent-grafana-dashboard.
Docker-cli (click here for more info)
qBittorrent >= 5.2.0:
docker run --name=qbittorrent-exporter \
-e QBITTORRENT_BASE_URL=http://192.168.1.10:8080 \
-e QBITTORRENT_API_KEY='<your_api_key>' \
-p 8090:8090 \
ghcr.io/martabal/qbittorrent-exporter:latestqBittorrent < 5.2.0:
docker run --name=qbittorrent-exporter \
-e QBITTORRENT_BASE_URL=http://192.168.1.10:8080 \
-e QBITTORRENT_PASSWORD='<your_password>' \
-e QBITTORRENT_USERNAME=admin \
-p 8090:8090 \
ghcr.io/martabal/qbittorrent-exporter:latestqBittorrent >= 5.2.0:
services:
qbittorrent-exporter:
image: ghcr.io/martabal/qbittorrent-exporter:latest
container_name: qbittorrent-exporter
environment:
- QBITTORRENT_BASE_URL=http://192.168.1.10:8080
- QBITTORRENT_API_KEY='<your_api_key>'
ports:
- 8090:8090
restart: unless-stoppedqBittorrent < 5.2.0:
services:
qbittorrent-exporter:
image: ghcr.io/martabal/qbittorrent-exporter:latest
container_name: qbittorrent-exporter
environment:
- QBITTORRENT_BASE_URL=http://192.168.1.10:8080
- QBITTORRENT_PASSWORD='<your_password>'
- QBITTORRENT_USERNAME=admin
ports:
- 8090:8090
restart: unless-stoppedgit clone https://github.com/martabal/qbittorrent-exporter.git
cd qbittorrent-exporter
go build -o ./qbittorrent-exporter
./qbittorrent-exporteror
git clone https://github.com/martabal/qbittorrent-exporter.git
cd qbittorrent-exporter
go run .If you want to use an .env file, edit .env.example to match your setup, rename it .env then run it in the same directory. If you want to force to use the environment variables use -e argument like :
./qbittorrent-exporter -eor
go run . -eYou can find in the dashboard the following metrics:
- All time download/upload
- Session download/upload
- Cumulative upload/download speeds
- Global ratio/download speed/upload speed
- qBittorrent version
- Torrent list with statuses
- Total torrents/seeders/leechers
- Torrent state chart
- Amount remaining by torrent
- Incomplete torrent progress
- Download/upload speed by torrent
- Categories
- Tags
- Trackers
This app uses ~20 times less RAM compared to the original exporter for the same amount of torrents. Docker compressed size is ~10 MB.
| Parameter | Function | Default Value |
|---|---|---|
-p 8090 |
Webservice port | |
-e QBITTORRENT_USERNAME |
qBittorrent username | admin |
-e QBITTORRENT_PASSWORD |
qBittorrent password | adminadmin |
-e QBITTORRENT_PASSWORD_FILE |
Path to a file containing the qBittorrent password. Overrides QBITTORRENT_PASSWORD if set. |
|
-e QBITTORRENT_BASE_URL |
qBittorrent base URL | http://localhost:8090 |
-e QBITTORRENT_BASIC_AUTH_USERNAME |
Send basic auth username request header (only if username or password are set) | |
-e QBITTORRENT_BASIC_AUTH_PASSWORD |
Send basic auth password request header (only if username or password are set) | |
-e QBITTORRENT_TIMEOUT |
Duration before ending a request to qBittorrent | 30 |
-e QBITTORRENT_FULL_REFRESH_INTERVAL |
Number of scrapes between full data syncs (prevents state drift) | 100 |
-e EXPORTER_PORT |
qBittorrent export port (optional) | 8090 |
-e EXPORTER_HOST |
Host or IP address to bind the exporter to (empty binds to all interfaces) | |
-e EXPORTER_BASIC_AUTH_USERNAME |
Use basic auth (only if username and password are set) | |
-e EXPORTER_BASIC_AUTH_PASSWORD |
Use basic auth (only if username and password are set) | |
-e LOG_LEVEL |
App log level (DEBUG, INFO, WARN, ERROR) |
INFO |
-e ENABLE_TRACKER |
Get tracker info | true |
-e ENABLE_HIGH_CARDINALITY |
Enable high cardinality metric (qbittorrent_torrent_info, qbittorrent_tracker_info) |
false |
-e ENABLE_LABEL_WITH_TRACKER |
[EXPERIMENTAL] Add the torrent tracker to qbittorrent_torrent_* metrics label |
false |
-e ENABLE_LABEL_WITH_HASH |
[EXPERIMENTAL] Add the torrent hash to qbittorrent_torrent_* metrics label |
false |
-e ENABLE_LABEL_WITH_TAG |
[EXPERIMENTAL] Add the torrent tag to qbittorrent_torrent_* metrics label |
false |
-e EXPORTER_URL |
The URL shown in the logs when starting the exporter | |
-e EXPORTER_PATH |
The path where the metrics are exposed | /metrics |
-e DANGEROUS_SHOW_PASSWORD |
Show the qBittorrent password in logs when starting the exporter | false |
-e CERTIFICATE_AUTHORITY_PATH |
Path to a CA (.crt) used to verify the qBittorrent TLS certificate |
|
-e INSECURE_SKIP_VERIFY |
Don't validate the TLS certificate presented by qBittorrent | false |
-e MIN_TLS_VERSION |
Only connect to qBittorrent if it supports at least this TLS version | TLS_1_3 |
-e ENABLE_INCREASED_CARDINALITY |
Enable high cardinality metric (qbittorrent_torrent_info, qbittorrent_torrent_save_path, qbittorrent_torrent_state, qbittorrent_torrent_comment) |
false |
For qBittorrent >= 5.2.0, you must specify either QBITTORRENT_API_KEY or QBITTORRENT_COOKIE_NAME.
| Arguments | Function |
|---|---|
| -e | If qbittorrent-exporter detects a .env file in the same directory, the values in the .env will be used, -e forces the usage of environment variables |
Add the target to your scrape_configs in your prometheus.yml file of your Prometheus instance.
scrape_configs:
- job_name: "qbittorrent"
static_configs:
- targets: ["<your_ip_address>:8090"]Contributions are welcome! To get started, copy and rename the .env.example file to .env, and run just dev from the root directory.




