Skip to content

martabal/qbittorrent-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qbittorrent-exporter

Publish Release Build Test

This app is a Prometheus exporter for qBittorrent. You must have version 4.1.0 of qBittorrent or higher.

Credits

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.

About this App

This app is a lightweight and fast prometheus exporter for qBittorrent, made to be integrated with the qbittorrent-grafana-dashboard.

Run it

docker run --name=qbit \
    -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:latest

Docker-compose

version: "2.1"
services:
  immich:
    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-stopped

Without docker

git clone https://github.com/martabal/qbittorrent-exporter.git
cd qbittorent-exporter
go get -d -v
cd src
go build -o ./qbittorrent-exporter
./qbittorrent-exporter

or

git clone https://github.com/martabal/qbittorrent-exporter.git
cd qbittorent-exporter
go get -d -v
cd src
go run ./src

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 -e

or

go run ./src -e

Metrics

You 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

Resources

This app uses ~20 times less RAM compared to the original exporter for the same amount of torrents. Docker compressed size is ~10 MB.

Dashboard

grafana-top grafana-bottom

Parameters

Environment variables

Parameters Function Default Value
-p 8090 Webservice port
-e QBITTORRENT_USERNAME qBittorrent username admin
-e QBITTORRENT_PASSWORD qBittorrent password adminadmin
-e QBITTORRENT_BASE_URL qBittorrent base URL http://localhost:8090
-e QBITTORRENT_TIMEOUT duration before ending a request to qBittorrent 30
-e EXPORTER_PORT qbittorrent export port (optional) 8090
-e LOG_LEVEL App log level (DEBUG, INFO, WARN and ERROR) INFO
-e ENABLE_TRACKER get tracker infos, true
-e ENABLE_HIGH_CARDINALITY enable high cardinality metric (qbittorrent_torrent_info and qbittorrent_tracker_info) false
-e ENABLE_LABEL_WITH_HASH [EXPERIMENTAL] add the torrent hash to the qbittorrent_torrent_* metrics label false

Arguments

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

Setup

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"]