# downloader-exporter
A prometheus exporter for qBitorrent/Transmission/Deluge. Get metrics from multiple servers and offers them in a prometheus format.
## How to use it
You can install this exporter with the following command:
```bash
pip3 install downloader-exporter
```
Then you can run it with
```
downloader-exporter -c CONFIG_FILE_PATH -p 9000
```
Another option is run it in a docker container.
```
docker run -d -v CONFIG_FILE_PATH:/config/config.yml -e EXPORTER_PORT=9000 -p 9000:9000 leishi1313/downloader-exporter
```
Add this to your prometheus.yml
```
- job_name: "downloader_exporter"
static_configs:
- targets: ['yourdownloaderexporter:port']
```
### The exporter is running too slow
#### Use params
You can use params to collector metrics from one or more downloaders as you chose, for example
```
curl localhost:9000/metrics?name[]=qb1
```
Will only fetch downloader named qb1 in your config.
Then you can use [multi-target-exporter](https://prometheus.io/docs/guides/multi-target-exporter/) to config your prometheus.
#### Use --multi
You can use an options to expose multiple ports for each downloader you're watching. Then the exporter will open a range of ports starting from the one you set, each port for each downloader
With command line
```
downloader-exporter -c CONFIG_FILE_PATH -p 9000 --multi true
```
With docker
```
docker run -d -v CONFIG_FILE_PATH:/config/config.yml -e EXPORTER_PORT=9000 -e USE_MULTI_PORTS=true -p 9000-9010:9000-9010 leishi1313/downloader-exporter
```
### How to connect to Deluge
Deluge uses three ports for different operations:
1. Incoming Port: Used by other torrent clients to connect to your instance.
2. WebUI Port: Used to access the Deluge WebUI.
3. **Daemon Port**: The one we need, this port is typically 58846, but you can confirm it by navigating to `Preferences -> Daemon` in the Deluge WebUI.
To connect to the daemon, you'll need the daemon username and password. These credentials are stored in a file named `auth`, located in Deluge's config folder. You can view the file's contents using the following command:
```shell
root@f80e4787ec08: cat /config/auth
localclient:011cc7842dc8ad50f165ab712a8ef110e06fd7c0:10
```
In this example you can use `localclient` as user and `011cc7842dc8ad50f165ab712a8ef110e06fd7c0` as password to connect.
It's always different on your machine and you can add your choice of user/password by following the existing pattern.
Check more at [Deluge Authentication](https://deluge-torrent.org/userguide/authentication/)
# Config file
The config file is compatible with [autoremove-torrents](https://github.com/jerrymakesjelly/autoremove-torrents), you can also refer to `example.yml` to see how to write it.
# Grafana
You can use the provided `docker-compose.yml` to host your own stack of `Grafana`/`Prometheus`/`downloader-exporter`.
Simplely clone this project, add or edit `config.yml`, then start the docker-compose:
```shell
cp example.yml config.yml
docker-compose up -d
```
Use `localhost:3000` and `admin`/`admin` to access the dashboard.
First you will need to add a data source, select `Prometheus` with URL `prometheus:9090`, Then go and add a new dashboard with ID `15006` (use `22677` for English version), the dashboard should look like
![](./grafana/screenshot.jpg)
Raw data
{
"_id": null,
"home_page": "https://github.com/leishi1313/downloader-exporter",
"name": "downloader-exporter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "prometheus, qbittorrent, transmission, deluge",
"author": "Lei Shi",
"author_email": "me@leishi.io",
"download_url": "https://files.pythonhosted.org/packages/fc/a1/e01e42ae1d28afa776a5151e5d9d66534f0ef46680e067ea3682bc48536a/downloader-exporter-0.5.2.tar.gz",
"platform": null,
"description": "# downloader-exporter\n\nA prometheus exporter for qBitorrent/Transmission/Deluge. Get metrics from multiple servers and offers them in a prometheus format.\n\n\n## How to use it\n\nYou can install this exporter with the following command:\n\n```bash\npip3 install downloader-exporter\n```\n\nThen you can run it with\n\n```\ndownloader-exporter -c CONFIG_FILE_PATH -p 9000\n```\n\nAnother option is run it in a docker container.\n\n```\ndocker run -d -v CONFIG_FILE_PATH:/config/config.yml -e EXPORTER_PORT=9000 -p 9000:9000 leishi1313/downloader-exporter\n```\nAdd this to your prometheus.yml\n```\n - job_name: \"downloader_exporter\"\n static_configs:\n - targets: ['yourdownloaderexporter:port']\n```\n\n### The exporter is running too slow\n\n#### Use params\n\nYou can use params to collector metrics from one or more downloaders as you chose, for example\n```\ncurl localhost:9000/metrics?name[]=qb1\n```\nWill only fetch downloader named qb1 in your config.\n\nThen you can use [multi-target-exporter](https://prometheus.io/docs/guides/multi-target-exporter/) to config your prometheus.\n\n#### Use --multi\n\nYou can use an options to expose multiple ports for each downloader you're watching. Then the exporter will open a range of ports starting from the one you set, each port for each downloader\n\nWith command line\n```\ndownloader-exporter -c CONFIG_FILE_PATH -p 9000 --multi true\n```\n\nWith docker\n```\ndocker run -d -v CONFIG_FILE_PATH:/config/config.yml -e EXPORTER_PORT=9000 -e USE_MULTI_PORTS=true -p 9000-9010:9000-9010 leishi1313/downloader-exporter\n```\n\n### How to connect to Deluge\n\nDeluge uses three ports for different operations:\n\n1. Incoming Port: Used by other torrent clients to connect to your instance.\n2. WebUI Port: Used to access the Deluge WebUI.\n3. **Daemon Port**: The one we need, this port is typically 58846, but you can confirm it by navigating to `Preferences -> Daemon` in the Deluge WebUI.\n\nTo connect to the daemon, you'll need the daemon username and password. These credentials are stored in a file named `auth`, located in Deluge's config folder. You can view the file's contents using the following command:\n\n```shell\nroot@f80e4787ec08: cat /config/auth\nlocalclient:011cc7842dc8ad50f165ab712a8ef110e06fd7c0:10\n```\n\nIn this example you can use `localclient` as user and `011cc7842dc8ad50f165ab712a8ef110e06fd7c0` as password to connect.\nIt's always different on your machine and you can add your choice of user/password by following the existing pattern.\nCheck more at [Deluge Authentication](https://deluge-torrent.org/userguide/authentication/)\n\n\n# Config file\n\nThe config file is compatible with [autoremove-torrents](https://github.com/jerrymakesjelly/autoremove-torrents), you can also refer to `example.yml` to see how to write it.\n\n# Grafana\n\nYou can use the provided `docker-compose.yml` to host your own stack of `Grafana`/`Prometheus`/`downloader-exporter`.\n\nSimplely clone this project, add or edit `config.yml`, then start the docker-compose:\n\n```shell\ncp example.yml config.yml\ndocker-compose up -d\n```\n\nUse `localhost:3000` and `admin`/`admin` to access the dashboard.\n\nFirst you will need to add a data source, select `Prometheus` with URL `prometheus:9090`, Then go and add a new dashboard with ID `15006` (use `22677` for English version), the dashboard should look like\n\n![](./grafana/screenshot.jpg)",
"bugtrack_url": null,
"license": null,
"summary": "Prometheus exporter for torrent downloader like qbittorrent/transmission/deluge",
"version": "0.5.2",
"project_urls": {
"Download": "https://github.com/leishi1313/downloader-exporter/archive/0.5.1.tar.gz",
"Homepage": "https://github.com/leishi1313/downloader-exporter"
},
"split_keywords": [
"prometheus",
" qbittorrent",
" transmission",
" deluge"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fca1e01e42ae1d28afa776a5151e5d9d66534f0ef46680e067ea3682bc48536a",
"md5": "822f560815a7ea09e11f227408dd54a9",
"sha256": "3f2f4b0d805b613572c4586e9e87a113e1e4c54c9c437f1296465e3413ae916a"
},
"downloads": -1,
"filename": "downloader-exporter-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "822f560815a7ea09e11f227408dd54a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 10571,
"upload_time": "2025-01-14T10:32:53",
"upload_time_iso_8601": "2025-01-14T10:32:53.706385Z",
"url": "https://files.pythonhosted.org/packages/fc/a1/e01e42ae1d28afa776a5151e5d9d66534f0ef46680e067ea3682bc48536a/downloader-exporter-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-14 10:32:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "leishi1313",
"github_project": "downloader-exporter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "downloader-exporter"
}