#metrics-exporter #q-bittorrent #ratio #included #dashboard #variables #simultaneously

app qbittorrent-metrics-exporter

A Prometheus exporter for qBittorrent that provides detailed torrent metrics with support for categories and tags. Collects both per-torrent statistics and aggregated metrics grouped by categories and tags.

2 releases

0.1.1 Apr 18, 2025
0.1.0 Feb 21, 2025

#1 in #q-bittorrent

Download history 120/week @ 2025-02-19 14/week @ 2025-02-26 6/week @ 2025-03-12 148/week @ 2025-04-16 19/week @ 2025-04-23

167 downloads per month

GPL-3.0 license

36KB
317 lines

qBittorrent Metrics Exporter

Crates.io License: GPLv3

A Prometheus exporter for qBittorrent that provides detailed torrent metrics with support for categories and tags. Collects both per-torrent statistics and aggregated metrics grouped by categories and tags.

What's Included

  • Monitor multiple qBittorrent instances simultaneously
  • Track individual torrent details (speed, size, ratio, etc.)
  • See aggregated stats for custom tags and categories
  • Ready-made metrics for Grafana dashboards
  • Configuration through environment variables

Installation

From Crates.io

cargo install qbittorrent-metrics-exporter

NixOS

Add to your configuration.nix:


services.prometheus.exporters.qbittorrent = {
  enable = true;
  port = 8000;
  host = "localhost";
  qbittorrentHosts = "http://localhost:8080";
  qbittorrentUsername = "your_username";
  qbittorrentPassword = "your_password";
};

and this to your flake.nix:

{
  inputs = {

    # Add this section to your flake inputs!
    qbittorrent-exporter.url = "git+https://codeberg.org/anriha/qbittorrent-metrics-exporter";
  }
  # <rest of configuration omitted>
}
{
  # <configuration above omitted>

  outputs = {nixpkgs, qbittorrent-metrics-exporter, ...}: {

      # The configuration here is an example; it will look slightly different
      # based on your platform (NixOS, nix-darwin) and architecture.
      nixosConfigurations.your-box = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux"

        modules = [

          # This is the important part -- add this line to your module list!
          qbittorrent-metrics-exporter.nixosModules.default
        ];

      };
  }

  # <configuration below omitted>
}

Configuration

Configure through environment variables:

Variable Default Description
PORT 8000 Port to expose metrics endpoint
HOST 0.0.0.0 Host address to bind to
QBITTORRENT_HOSTS http://localhost Comma-separated list of qBittorrent WebUI URLs
QBITTORRENT_USERNAME admin qBittorrent WebUI username
QBITTORRENT_PASSWORD adminadmin qBittorrent WebUI password

Metrics

Per Torrent/Category/Tag (with name/category/hash labels):

  • Download/upload speeds
  • Downloaded/uploaded total/session
  • Progress percentage
  • Seeding time
  • Share ratio
  • Active peers (leechers/seeds)

Full list available at /metrics endpoint.

Prometheus Integration

scrape_configs:
  - job_name: "qbittorrent"
    scrape_interval: 60s
    static_configs:
      - targets: ["exporter-host:8000"]

License

This project is licensed under GNU GPLv3.

Dependencies

~13–27MB
~402K SLoC