GithubHelp home page GithubHelp logo

esanchezm / prometheus-qbittorrent-exporter Goto Github PK

View Code? Open in Web Editor NEW
104.0 4.0 24.0 675 KB

A prometheus exporter for qbittorrent written in Python. Simple. Works. Docker image

License: GNU General Public License v3.0

Python 97.94% Dockerfile 2.06%
prometheus-exporter qbittorrent python3 qbittorrent-api

prometheus-qbittorrent-exporter's Introduction

Prometheus qBittorrent exporter

A prometheus exporter for qBitorrent. Get metrics from a server and offers them in a prometheus format.

Coverage badge

How to use it

You can install this exporter with the following command:

pip3 install prometheus-qbittorrent-exporter

Then you can run it with

qbittorrent-exporter

Another option is run it in a docker container.

docker run \
    -e QBITTORRENT_PORT=8080 \
    -e QBITTORRENT_HOST=myserver.local \
    -p 8000:8000 \
    ghcr.io/esanchezm/prometheus-qbittorrent-exporter

Add this to your prometheus.yml

  - job_name: "qbittorrent_exporter"
    static_configs:
        - targets: ['yourqbittorrentexporter:port']

The application reads configuration using environment variables:

Environment variable Default Description
QBITTORRENT_HOST qbittorrent server hostname
QBITTORRENT_PORT qbittorrent server port
QBITTORRENT_SSL False Whether to use SSL to connect or not. Will be forced to True when using port 443
QBITTORRENT_URL_BASE "" qbittorrent server path or base URL
QBITTORRENT_USER "" qbittorrent username
QBITTORRENT_PASS "" qbittorrent password
EXPORTER_PORT 8000 Exporter listening port
EXPORTER_LOG_LEVEL INFO Log level. One of: DEBUG, INFO, WARNING, ERROR, CRITICAL
METRICS_PREFIX qbittorrent Prefix to add to all the metrics
VERIFY_WEBUI_CERTIFICATE True Whether to verify SSL certificate when connecting to the qbittorrent server. Any other value but True will disable the verification

Metrics

These are the metrics this program exports, assuming the METRICS_PREFIX is qbittorrent:

Metric name Type Description
qbittorrent_up gauge Whether the qBittorrent server is answering requests from this exporter. A version label with the server version is added.
qbittorrent_connected gauge Whether the qBittorrent server is connected to the Bittorrent network.
qbittorrent_firewalled gauge Whether the qBittorrent server is connected to the Bittorrent network but is behind a firewall.
qbittorrent_dht_nodes gauge Number of DHT nodes connected to.
qbittorrent_dl_info_data counter Data downloaded since the server started, in bytes.
qbittorrent_up_info_data counter Data uploaded since the server started, in bytes.
qbittorrent_alltime_dl_total counter Total historical data downloaded, in bytes.
qbittorrent_alltime_ul_total counter Total historical data uploaded, in bytes.
qbittorrent_torrents_count gauge Number of torrents for each category and status. Example: qbittorrent_torrents_count{category="movies",status="downloading"}

Screenshot

More info

License

This software is released under the GPLv3 license.

prometheus-qbittorrent-exporter's People

Contributors

angristan avatar averyanalex avatar chrisjohnson00 avatar esanchezm avatar gabisonfire avatar jakami99 avatar jhollowe avatar joelheaps avatar jsawatzky avatar ndragon798 avatar ngosang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

prometheus-qbittorrent-exporter's Issues

Tags for the last two releases not publish to docker registry

It seems the recent versions aren't published to the docker registry.

$ docker pull esanchezm/prometheus-qbittorrent-exporter:v1.3.0
Error response from daemon: manifest for esanchezm/prometheus-qbittorrent-exporter:v1.3.0 not found: manifest unknown: manifest unknown

$ docker pull esanchezm/prometheus-qbittorrent-exporter:v1.4.0
Error response from daemon: manifest for esanchezm/prometheus-qbittorrent-exporter:v1.4.0 not found: manifest unknown: manifest unknown

$ podman search --list-tags esanchezm/prometheus-qbittorrent-exporter                                       
NAME                                                 TAG
docker.io/esanchezm/prometheus-qbittorrent-exporter  latest
docker.io/esanchezm/prometheus-qbittorrent-exporter  master
docker.io/esanchezm/prometheus-qbittorrent-exporter  v1.0.1
docker.io/esanchezm/prometheus-qbittorrent-exporter  v1.0.2
docker.io/esanchezm/prometheus-qbittorrent-exporter  v1.1.0
docker.io/esanchezm/prometheus-qbittorrent-exporter  v1.1.1
docker.io/esanchezm/prometheus-qbittorrent-exporter  v1.2.0

I would appreciate if tags for the new releases were also published!

For what it's worth, :latest and :master seem to be updated, but I'd still prefer version tags for releases. That way I can use for example Renovate or Dependabot to get alerted about updates. I also assume versioned releases are considered more stable than continuously following master.

Question about this software

Sorry, i try to reach via X but, i can't message directly...
So.. i have multiple clients.
How i can handle 5-6 clients at the same times
All clients are qbittorrent installed on Ubuntu.
Thank you.

Adding furthe export data to image

Is there a way there could be more data exported in regards to the following?

Export of invididual torrent information (Name of torrent, eta, progress. etc.)
Include "Stalled" in the status of the torrents.

Grafana dashboard doesn't work with v8 or Kubernetes deoloys

There are some changes in v8 that seem to make the dashboard not work anymore. I'm creating this issue after the fact (I've fixed it), so I don't have specifics, sorry. I do remember that the $DS_PROMETHEUS input wouldn't work for me.

Also, the dashboard was created with the expectation that the container name never changes. However, in a Kubernetes deployment, the container name only lasts as long as the container is running, so it results in multiple series of data being displayed when the container is replaced, which isn't what is intended for some of the panels.

Metrics should have a qbittorrent_ prefix

Metrics should be prepended with qbittorrent_ for clarity and to follow https://prometheus.io/docs/practices/naming/.

I have multiple application I'm collecting and qbittorrent's ones are scattered because of this.

I can make a PR later to fix this but wanted to ask here first. Cheers!

[Feature Request] All-Time

Would it be possible to include the (All-time) "upload", "download" and "share ratio" which is shown under View>Statistics in the Web UI?
Or is the used python module not supporting those values.
Sadly, I was not able to dig into the python code from the module to check if my request is obsolete.

Thanks for the project <3

Publish image to GHCR

Dockerhub rate limits are a pita, it would be cool if you could push this image to the github container registry. It's not hard to do.

Thanks!

ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Hello,
i tried to install this on my instance, but sadly it is not working. The goal would be to deploy it without the docker container.

How to reproduce it on my side:
Install:

jellyfin@jellyfin:~$ pip3 install prometheus-qbittorrent-exporter
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: prometheus-qbittorrent-exporter in /usr/local/lib/python3.10/dist-packages (1.2.0)
Requirement already satisfied: python-json-logger==0.1.5 in ./.local/lib/python3.10/site-packages (from prometheus-qbittorrent-exporter) (0.1.5)
Requirement already satisfied: attrdict==2.0.1 in ./.local/lib/python3.10/site-packages (from prometheus-qbittorrent-exporter) (2.0.1)
Requirement already satisfied: qbittorrent-api==2021.3.18 in ./.local/lib/python3.10/site-packages (from prometheus-qbittorrent-exporter) (2021.3.18)
Requirement already satisfied: prometheus-client==0.8.0 in ./.local/lib/python3.10/site-packages (from prometheus-qbittorrent-exporter) (0.8.0)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from attrdict==2.0.1->prometheus-qbittorrent-exporter) (1.16.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from python-json-logger==0.1.5->prometheus-qbittorrent-exporter) (59.6.0)
Requirement already satisfied: requests>=2.16.0 in /usr/lib/python3/dist-packages (from qbittorrent-api==2021.3.18->prometheus-qbittorrent-exporter) (2.25.1)
Requirement already satisfied: urllib3>=1.24.2 in /usr/lib/python3/dist-packages (from qbittorrent-api==2021.3.18->prometheus-qbittorrent-exporter) (1.26.5)

Run it:

jellyfin@jellyfin:~$ qbittorrent-exporter
Traceback (most recent call last):
  File "/usr/local/bin/qbittorrent-exporter", line 5, in <module>
    from qbittorrent_exporter.exporter import main
  File "/usr/local/lib/python3.10/dist-packages/qbittorrent_exporter/exporter.py", line 6, in <module>
    from attrdict import AttrDict
  File "/home/jellyfin/.local/lib/python3.10/site-packages/attrdict/__init__.py", line 5, in <module>
    from attrdict.mapping import AttrMap
  File "/home/jellyfin/.local/lib/python3.10/site-packages/attrdict/mapping.py", line 4, in <module>
    from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

I am using the following python version:

jellyfin@jellyfin:~$ python3 --version
Python 3.10.12

Pipenv project

If you will use pipenv or poetry, you can setup dependabot auto-updates. What about it?

Error on forced downloads

ValueError: 'forcedDL' is not a valid TorrentStates

Got this because I have a torrent in "Forced Downloading", might be some missing states.

ModuleNotFoundError: No module named 'attrdict'

Hi,
I am getting a missing module with the latest pull:

Traceback (most recent call last):
File "/usr/bin/qbittorrent-exporter", line 33, in
sys.exit(load_entry_point('prometheus-qbittorrent-exporter==1.1.1', 'console_scripts', 'qbittorrent-exporter')())
File "/usr/bin/qbittorrent-exporter", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.8/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/usr/lib/python3.8/site-packages/qbittorrent_exporter/exporter.py", line 6, in
from attrdict import AttrDict
ModuleNotFoundError: No module named 'attrdict'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.