├── tests ├── __init__.py ├── metric_test.py └── exporter_test.py ├── qbittorrent_exporter ├── __init__.py └── exporter.py ├── .coveragerc ├── logo.png ├── grafana ├── screenshot.png ├── README.md └── dashboard.json ├── .github ├── dependabot.yml └── workflows │ ├── pythonpublish.yml │ ├── lint.yml │ └── docker.yml ├── .dockerignore ├── config.env.example ├── renovate.json ├── Dockerfile ├── pyproject.toml ├── .pre-commit-config.yaml ├── .gitignore ├── README.md ├── pdm.lock └── LICENSE /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qbittorrent_exporter/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | relative_files = True 3 | omit = tests/* 4 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esanchezm/prometheus-qbittorrent-exporter/HEAD/logo.png -------------------------------------------------------------------------------- /grafana/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esanchezm/prometheus-qbittorrent-exporter/HEAD/grafana/screenshot.png -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "pip" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/__pycache__/ 2 | .coverage* 3 | .git 4 | .github 5 | .gitignore 6 | .pdm* 7 | .pre-commit-config.yaml 8 | .vscode 9 | build/ 10 | logo.png 11 | tests 12 | -------------------------------------------------------------------------------- /config.env.example: -------------------------------------------------------------------------------- 1 | QBITTORRENT_HOST=localhost 2 | QBITTORRENT_PORT=8080 3 | QBITTORRENT_USER=admin 4 | QBITTORRENT_PASS=adminadmin 5 | EXPORTER_ADDRESS=0.0.0.0 6 | EXPORTER_PORT=8000 7 | METRICS_PREFIX=qbittorrent -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:best-practices" 5 | ], 6 | "lockFileMaintenance": { 7 | "enabled": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /grafana/README.md: -------------------------------------------------------------------------------- 1 | # Grafana dashboard 2 | 3 | ## Import 4 | 5 | To import the dashboard into your grafana, download the [dashboard.json](https://raw.githubusercontent.com/esanchezm/prometheus-qbittorrent-exporter/master/grafana/dashboard.json) file and import it into your server. Select your prometheus instance and that should be all. 6 | 7 | ## Screenshot 8 | 9 | ![](./screenshot.png) 10 | -------------------------------------------------------------------------------- /tests/metric_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from qbittorrent_exporter.exporter import Metric, MetricType 4 | 5 | 6 | class TestMetric(unittest.TestCase): 7 | def test_metric_initialization(self): 8 | metric = Metric(name="test_metric", value=10) 9 | self.assertEqual(metric.name, "test_metric") 10 | self.assertEqual(metric.value, 10) 11 | self.assertEqual(metric.labels, {}) 12 | self.assertEqual(metric.help_text, "") 13 | self.assertEqual(metric.metric_type, MetricType.GAUGE) 14 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PYTHON_BASE=3.13-alpine@sha256:18159b2be11db91f84b8f8f655cd860f805dbd9e49a583ddaac8ab39bf4fe1a7 2 | FROM python:$PYTHON_BASE AS builder 3 | 4 | RUN pip install -U pdm 5 | ENV PDM_CHECK_UPDATE=false 6 | COPY pyproject.toml pdm.lock README.md /project/ 7 | COPY qbittorrent_exporter/ /project/qbittorrent_exporter 8 | 9 | WORKDIR /project 10 | RUN pdm install --check --prod --no-editable 11 | 12 | FROM python:$PYTHON_BASE 13 | 14 | COPY --from=builder /project/.venv/ /project/.venv 15 | ENV PATH="/project/.venv/bin:$PATH" 16 | 17 | ENV QBITTORRENT_HOST="" 18 | ENV QBITTORRENT_PORT="" 19 | ENV QBITTORRENT_USER="" 20 | ENV QBITTORRENT_PASS="" 21 | ENV EXPORTER_PORT="8000" 22 | ENV EXPORTER_LOG_LEVEL="INFO" 23 | 24 | ENTRYPOINT ["qbittorrent-exporter"] 25 | -------------------------------------------------------------------------------- /.github/workflows/pythonpublish.yml: -------------------------------------------------------------------------------- 1 | name: Upload Python Package 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | jobs: 8 | deploy: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 12 | - name: Set up Python 13 | uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 14 | with: 15 | python-version: '3.13' 16 | - name: Install dependencies 17 | run: | 18 | python -m pip install --upgrade pip 19 | pip install setuptools wheel twine 20 | - name: Build and publish 21 | env: 22 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 23 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 24 | run: | 25 | python -m build 26 | twine upload dist/* 27 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "prometheus-qbittorrent-exporter" 3 | version = "1.5.1" 4 | description = "Prometheus exporter for qbittorrent" 5 | authors = [ 6 | {name = "Esteban Sanchez", email = "esteban.sanchez@gmail.com"}, 7 | ] 8 | dependencies = [ 9 | "prometheus-client>=0.20.0", 10 | "python-json-logger>=2.0.7", 11 | "qbittorrent-api>=2024.5.62", 12 | ] 13 | requires-python = ">=3.11" 14 | readme = "README.md" 15 | keywords = ["prometheus", "qbittorrent"] 16 | license = {text = "GPL-3.0"} 17 | classifiers = [] 18 | 19 | [project.urls] 20 | Homepage = "https://github.com/esanchezm/prometheus-qbittorrent-exporter" 21 | Downloads = "https://github.com/esanchezm/prometheus-qbittorrent-exporter/archive/1.5.1.tar.gz" 22 | 23 | [project.scripts] 24 | qbittorrent-exporter = "qbittorrent_exporter.exporter:main" 25 | 26 | [build-system] 27 | requires = ["pdm-backend"] 28 | build-backend = "pdm.backend" 29 | 30 | [tool.pdm.dev-dependencies] 31 | dev = [ 32 | "pytest>=8.2.1", 33 | "isort>=5.13.2", 34 | "black>=24.4.2", 35 | "coverage>=7.5.3", 36 | "ruff>=0.6.2", 37 | ] 38 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: local 3 | hooks: 4 | - id: black 5 | name: black 6 | stages: [commit] 7 | types: [python] 8 | entry: pdm run black . 9 | language: system 10 | pass_filenames: false 11 | always_run: true 12 | - id: ruff 13 | name: ruff 14 | stages: [commit] 15 | types: [python] 16 | entry: pdm run ruff check . 17 | language: system 18 | pass_filenames: false 19 | always_run: true 20 | fail_fast: true 21 | always_run: true 22 | - id: isort 23 | name: isort 24 | stages: [commit] 25 | types: [python] 26 | entry: pdm run isort . --profile black 27 | language: system 28 | pass_filenames: false 29 | always_run: true 30 | fail_fast: true 31 | - id: pytest 32 | name: pytest 33 | stages: [commit] 34 | types: [python] 35 | entry: pdm run pytest 36 | language: system 37 | pass_filenames: false 38 | always_run: true 39 | fail_fast: true 40 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Run Unit Test via Pytest 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - "master" 8 | 9 | jobs: 10 | lint-and-test: 11 | runs-on: ubuntu-latest 12 | permissions: 13 | pull-requests: write 14 | contents: write 15 | checks: write 16 | strategy: 17 | matrix: 18 | python-version: 19 | - "3.11" 20 | - "3.12" 21 | - "3.13" 22 | 23 | steps: 24 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 25 | - name: Set up Python ${{ matrix.python-version }} 26 | uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 27 | with: 28 | python-version: ${{ matrix.python-version }} 29 | - name: Setup PDM 30 | uses: pdm-project/setup-pdm@b2472ca4258a9ea3aee813980a0100a2261a42fc # v4 31 | - name: Install dependencies 32 | run: pdm install 33 | - name: Lint with black 34 | uses: psf/black@stable 35 | with: 36 | options: "--check --verbose" 37 | - name: Test with pytest 38 | run: | 39 | pdm run pytest --junit-xml=test-results.xml 40 | - name: Publish Test Results 41 | uses: EnricoMi/publish-unit-test-result-action@afb2984f4d89672b2f9d9c13ae23d53779671984 # v2 42 | if: always() 43 | with: 44 | files: | 45 | test-results.xml 46 | - name: Test with coverage 47 | run: | 48 | pdm run coverage run -m pytest -v -s 49 | - name: Generate Coverage Report 50 | run: | 51 | pdm run coverage report -m 52 | - name: Coverage comment 53 | id: coverage_comment 54 | uses: py-cov-action/python-coverage-comment-action@fb02115d6115e7b3325dc3295fe1dcfb1919248a # v3 55 | with: 56 | GITHUB_TOKEN: ${{ github.token }} 57 | - name: Store Pull Request comment to be posted 58 | uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 59 | if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' 60 | with: 61 | name: python-coverage-comment-action 62 | path: python-coverage-comment-action.txt 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | # Ignore config.env 132 | config.env 133 | 134 | # Ignore pdm local files 135 | .pdm-python 136 | 137 | # Ignore ruff files 138 | .ruff_cache 139 | -------------------------------------------------------------------------------- /.github/workflows/docker.yml: -------------------------------------------------------------------------------- 1 | name: Docker 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | tags: [ '*' ] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: 'Checkout GitHub Action' 13 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 14 | 15 | - name: Set up QEMU 16 | uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3 17 | 18 | - name: Set up Docker Buildx 19 | uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 20 | 21 | - name: Docker hub meta 22 | id: meta 23 | uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5 24 | with: 25 | flavor: | 26 | latest=true 27 | tags: | 28 | type=pep440,prefix=v,pattern={{version}} 29 | type=ref,event=branch 30 | type=sha 31 | images: ${{ github.actor }}/prometheus-qbittorrent-exporter 32 | 33 | - name: Login to DockerHub 34 | uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 35 | with: 36 | username: ${{ secrets.REGISTRY_USERNAME }} 37 | password: ${{ secrets.REGISTRY_PASSWORD }} 38 | 39 | - name: Build and push docker to DockerHub 40 | uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6 41 | with: 42 | push: true 43 | platforms: linux/amd64,linux/arm64,linux/386 44 | tags: ${{ steps.meta.outputs.tags }} 45 | labels: ${{ steps.meta.outputs.labels }} 46 | 47 | - name: GHCR Docker meta 48 | id: metaghcr 49 | uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5 50 | with: 51 | flavor: | 52 | latest=true 53 | tags: | 54 | type=pep440,prefix=v,pattern={{version}} 55 | type=ref,event=branch 56 | type=sha 57 | images: ghcr.io/${{ github.actor }}/prometheus-qbittorrent-exporter 58 | 59 | - name: Login to Github Container Registry 60 | uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 61 | with: 62 | registry: ghcr.io 63 | username: ${{ github.actor }} 64 | password: ${{ secrets.GITHUB_TOKEN }} 65 | 66 | - name: Build and push docker to Github Container Registry 67 | uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6 68 | with: 69 | push: true 70 | platforms: linux/amd64,linux/arm64,linux/386 71 | tags: ${{ steps.metaghcr.outputs.tags }} 72 | labels: ${{ steps.metaghcr.outputs.labels }} 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Prometheus qBittorrent exporter 2 | 3 |

4 | 5 |

6 | 7 | A prometheus exporter for qBittorrent. Get metrics from a server and offers them in a prometheus format. 8 | 9 | ![](https://img.shields.io/github/license/esanchezm/prometheus-qbittorrent-exporter?style=for-the-badge) ![](https://img.shields.io/maintenance/yes/2024?style=for-the-badge) ![](https://img.shields.io/docker/pulls/esanchezm/prometheus-qbittorrent-exporter?style=for-the-badge) ![](https://img.shields.io/github/forks/esanchezm/prometheus-qbittorrent-exporter?style=for-the-badge) ![](https://img.shields.io/github/stars/esanchezm/prometheus-qbittorrent-exporter?style=for-the-badge) ![](https://img.shields.io/python/required-version-toml?tomlFilePath=https://raw.githubusercontent.com/esanchezm/prometheus-qbittorrent-exporter/master/pyproject.toml&style=for-the-badge) [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/esanchezm/prometheus-qbittorrent-exporter/python-coverage-comment-action-data/endpoint.json&label=tests%20coverage&style=for-the-badge)](https://htmlpreview.github.io/?https://github.com/esanchezm/prometheus-qbittorrent-exporter/blob/python-coverage-comment-action-data/htmlcov/index.html) 10 | 11 | ## How to use it 12 | 13 | You can install this exporter with the following command: 14 | 15 | ```bash 16 | pip3 install prometheus-qbittorrent-exporter 17 | ``` 18 | 19 | Then you can run it with 20 | 21 | ``` 22 | qbittorrent-exporter 23 | ``` 24 | 25 | Another option is run it in a docker container. 26 | 27 | ``` 28 | docker run \ 29 | -e QBITTORRENT_PORT=8080 \ 30 | -e QBITTORRENT_HOST=myserver.local \ 31 | -p 8000:8000 \ 32 | ghcr.io/esanchezm/prometheus-qbittorrent-exporter 33 | ``` 34 | Add this to your prometheus.yml 35 | ``` 36 | - job_name: "qbittorrent_exporter" 37 | static_configs: 38 | - targets: ['yourqbittorrentexporter:port'] 39 | ``` 40 | The application reads configuration using environment variables: 41 | 42 | | Environment variable | Default | Description | 43 | | -------------------------- | ------------- | ----------- | 44 | | `QBITTORRENT_HOST` | | qbittorrent server hostname | 45 | | `QBITTORRENT_PORT` | | qbittorrent server port | 46 | | `QBITTORRENT_SSL` | `False` | Whether to use SSL to connect or not. Will be forced to `True` when using port 443 | 47 | | `QBITTORRENT_URL_BASE` | `""` | qbittorrent server path or base URL | 48 | | `QBITTORRENT_USER` | `""` | qbittorrent username | 49 | | `QBITTORRENT_PASS` | `""` | qbittorrent password | 50 | | `EXPORTER_ADDRESS` | `0.0.0.0` | Exporter listening IP address | 51 | | `EXPORTER_PORT` | `8000` | Exporter listening port | 52 | | `EXPORTER_LOG_LEVEL` | `INFO` | Log level. One of: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL` | 53 | | `METRICS_PREFIX` | `qbittorrent` | Prefix to add to all the metrics | 54 | | `VERIFY_WEBUI_CERTIFICATE` | `True` | Whether to verify SSL certificate when connecting to the qbittorrent server. Any other value but `True` will disable the verification | 55 | 56 | 57 | ## Metrics 58 | 59 | These are the metrics this program exports, assuming the `METRICS_PREFIX` is `qbittorrent`: 60 | 61 | 62 | | Metric name | Type | Description | 63 | | --------------------------------------------------- | -------- | ---------------- | 64 | | `qbittorrent_up` | gauge | Whether the qBittorrent server is answering requests from this exporter. A `version` label with the server version is added. | 65 | | `qbittorrent_connected` | gauge | Whether the qBittorrent server is connected to the Bittorrent network. | 66 | | `qbittorrent_firewalled` | gauge | Whether the qBittorrent server is connected to the Bittorrent network but is behind a firewall. | 67 | | `qbittorrent_dht_nodes` | gauge | Number of DHT nodes connected to. | 68 | | `qbittorrent_dl_info_data` | counter | Data downloaded since the server started, in bytes. | 69 | | `qbittorrent_up_info_data` | counter | Data uploaded since the server started, in bytes. | 70 | | `qbittorrent_alltime_dl_total` | counter | Total historical data downloaded, in bytes. | 71 | | `qbittorrent_alltime_ul_total` | counter | Total historical data uploaded, in bytes. | 72 | | `qbittorrent_torrents_count` | gauge | Number of torrents for each `category` and `status`. Example: `qbittorrent_torrents_count{category="movies",status="downloading"}`| 73 | 74 | ## Screenshot 75 | 76 | ![](./grafana/screenshot.png) 77 | 78 | [More info](./grafana/README.md) 79 | 80 | ## License 81 | 82 | This software is released under the [GPLv3 license](LICENSE). 83 | -------------------------------------------------------------------------------- /qbittorrent_exporter/exporter.py: -------------------------------------------------------------------------------- 1 | import faulthandler 2 | import logging 3 | import os 4 | import signal 5 | import sys 6 | import time 7 | from dataclasses import dataclass, field 8 | from enum import StrEnum, auto 9 | from typing import Any, Iterable 10 | 11 | from prometheus_client import start_http_server 12 | from prometheus_client.core import REGISTRY, CounterMetricFamily, GaugeMetricFamily 13 | from pythonjsonlogger import jsonlogger 14 | from qbittorrentapi import Client, TorrentStates 15 | 16 | # Enable dumps on stderr in case of segfault 17 | faulthandler.enable() 18 | logger = logging.getLogger() 19 | 20 | 21 | class MetricType(StrEnum): 22 | """ 23 | Represents possible metric types (used in this project). 24 | """ 25 | 26 | GAUGE = auto() 27 | COUNTER = auto() 28 | 29 | 30 | @dataclass 31 | class Metric: 32 | """ 33 | Contains data and metadata about a single counter or gauge. 34 | """ 35 | 36 | name: str 37 | value: Any 38 | labels: dict[str, str] = field(default_factory=lambda: {}) 39 | help_text: str = "" 40 | metric_type: MetricType = MetricType.GAUGE 41 | 42 | 43 | class QbittorrentMetricsCollector: 44 | def __init__(self, config: dict) -> None: 45 | self.config = config 46 | self.server = f"{config['host']}:{config['port']}" 47 | self.protocol = "http" 48 | 49 | if config["url_base"]: 50 | self.server = f"{self.server}/{config['url_base']}" 51 | if config["ssl"] or config["port"] == "443": 52 | self.protocol = "https" 53 | self.connection_string = f"{self.protocol}://{self.server}" 54 | self.client = Client( 55 | host=self.connection_string, 56 | username=config["username"], 57 | password=config["password"], 58 | VERIFY_WEBUI_CERTIFICATE=config["verify_webui_certificate"], 59 | ) 60 | 61 | def collect(self) -> Iterable[GaugeMetricFamily | CounterMetricFamily]: 62 | """ 63 | Yields Prometheus gauges and counters from metrics collected from qbittorrent. 64 | """ 65 | for metric in self._get_qbittorrent_status_metrics(): 66 | if metric.metric_type == MetricType.COUNTER: 67 | prom_metric = CounterMetricFamily( 68 | metric.name, metric.help_text, labels=list(metric.labels.keys()) 69 | ) 70 | else: 71 | prom_metric = GaugeMetricFamily( 72 | metric.name, metric.help_text, labels=list(metric.labels.keys()) 73 | ) 74 | prom_metric.add_metric( 75 | value=metric.value, labels=list(metric.labels.values()) 76 | ) 77 | yield prom_metric 78 | 79 | for gauge in self._get_qbittorrent_by_torrent_metric_gauges(): 80 | yield gauge 81 | 82 | yield self._get_qbittorrent_torrent_tags_metrics_gauge() 83 | 84 | def _get_qbittorrent_by_torrent_metric_gauges(self) -> list[GaugeMetricFamily]: 85 | if not self.config.get("export_metrics_by_torrent", False): 86 | return [] 87 | 88 | torrent_size_gauge = GaugeMetricFamily( 89 | f"{self.config['metrics_prefix']}_torrent_size", 90 | "Size of the torrent", 91 | labels=["name", "category", "server"], 92 | ) 93 | 94 | torrent_downloaded_gauge = GaugeMetricFamily( 95 | f"{self.config['metrics_prefix']}_torrent_downloaded", 96 | "Downloaded data for the torrent", 97 | labels=["name", "category", "server"], 98 | ) 99 | 100 | for torrent in self._fetch_torrents(): 101 | torrent_size_gauge.add_metric( 102 | value=torrent["size"], 103 | labels=[torrent["name"], torrent["category"], self.server], 104 | ) 105 | torrent_downloaded_gauge.add_metric( 106 | value=torrent["downloaded"], 107 | labels=[torrent["name"], torrent["category"], self.server], 108 | ) 109 | 110 | return [torrent_size_gauge, torrent_downloaded_gauge] 111 | 112 | def _get_qbittorrent_status_metrics(self) -> list[Metric]: 113 | """ 114 | Returns metrics about the state of the qbittorrent server. 115 | """ 116 | maindata: dict[str, Any] = {} 117 | version: str = "" 118 | 119 | # Fetch data from API 120 | try: 121 | maindata = self.client.sync_maindata() 122 | version = self.client.app.version 123 | except Exception as e: 124 | logger.error(f"Couldn't get server info: {e}") 125 | 126 | server_state = maindata.get("server_state", {}) 127 | 128 | return [ 129 | Metric( 130 | name=f"{self.config['metrics_prefix']}_up", 131 | value=bool(server_state), 132 | labels={"version": version, "server": self.server}, 133 | help_text=( 134 | "Whether the qBittorrent server is answering requests from this" 135 | " exporter. A `version` label with the server version is added." 136 | ), 137 | ), 138 | Metric( 139 | name=f"{self.config['metrics_prefix']}_connected", 140 | value=server_state.get("connection_status", "") == "connected", 141 | labels={"server": self.server}, 142 | help_text=( 143 | "Whether the qBittorrent server is connected to the Bittorrent" 144 | " network." 145 | ), 146 | ), 147 | Metric( 148 | name=f"{self.config['metrics_prefix']}_firewalled", 149 | value=server_state.get("connection_status", "") == "firewalled", 150 | labels={"server": self.server}, 151 | help_text=( 152 | "Whether the qBittorrent server is connected to the Bittorrent" 153 | " network but is behind a firewall." 154 | ), 155 | ), 156 | Metric( 157 | name=f"{self.config['metrics_prefix']}_dht_nodes", 158 | value=server_state.get("dht_nodes", 0), 159 | labels={"server": self.server}, 160 | help_text="Number of DHT nodes connected to.", 161 | ), 162 | Metric( 163 | name=f"{self.config['metrics_prefix']}_total_peer_connections", 164 | value=server_state.get("total_peer_connections", 0), 165 | labels={"server": self.server}, 166 | help_text="Total number of peer connections.", 167 | ), 168 | Metric( 169 | name=f"{self.config['metrics_prefix']}_dl_info_data", 170 | value=server_state.get("dl_info_data", 0), 171 | labels={"server": self.server}, 172 | help_text="Data downloaded since the server started, in bytes.", 173 | metric_type=MetricType.COUNTER, 174 | ), 175 | Metric( 176 | name=f"{self.config['metrics_prefix']}_up_info_data", 177 | value=server_state.get("up_info_data", 0), 178 | labels={"server": self.server}, 179 | help_text="Data uploaded since the server started, in bytes.", 180 | metric_type=MetricType.COUNTER, 181 | ), 182 | Metric( 183 | name=f"{self.config['metrics_prefix']}_alltime_dl", 184 | value=server_state.get("alltime_dl", 0), 185 | labels={"server": self.server}, 186 | help_text="Total historical data downloaded, in bytes.", 187 | metric_type=MetricType.COUNTER, 188 | ), 189 | Metric( 190 | name=f"{self.config['metrics_prefix']}_alltime_ul", 191 | value=server_state.get("alltime_ul", 0), 192 | labels={"server": self.server}, 193 | help_text="Total historical data uploaded, in bytes.", 194 | metric_type=MetricType.COUNTER, 195 | ), 196 | ] 197 | 198 | def _fetch_categories(self) -> dict: 199 | """Fetches all categories in use from qbittorrent.""" 200 | try: 201 | categories = dict(self.client.torrent_categories.categories) 202 | for key, value in categories.items(): 203 | categories[key] = dict(value) # type: ignore 204 | return categories 205 | except Exception as e: 206 | logger.error(f"Couldn't fetch categories: {e}") 207 | return {} 208 | 209 | def _fetch_torrents(self) -> list[dict]: 210 | """Fetches torrents from qbittorrent""" 211 | try: 212 | return [dict(_attr_dict) for _attr_dict in self.client.torrents.info()] 213 | except Exception as e: 214 | logger.error(f"Couldn't fetch torrents: {e}") 215 | return [] 216 | 217 | def _filter_torrents_by_category( 218 | self, category: str, torrents: list[dict] 219 | ) -> list[dict]: 220 | """Filters torrents by the given category.""" 221 | return [ 222 | torrent 223 | for torrent in torrents 224 | if torrent["category"] == category 225 | or (category == "Uncategorized" and torrent["category"] == "") 226 | ] 227 | 228 | def _filter_torrents_by_state( 229 | self, state: TorrentStates, torrents: list[dict] 230 | ) -> list[dict]: 231 | """Filters torrents by the given state.""" 232 | return [torrent for torrent in torrents if torrent["state"] == state.value] 233 | 234 | def _get_qbittorrent_torrent_tags_metrics_gauge(self) -> GaugeMetricFamily: 235 | categories = self._fetch_categories() 236 | torrents = self._fetch_torrents() 237 | 238 | metrics: list[Metric] = [] 239 | categories["Uncategorized"] = {"name": "Uncategorized", "savePath": ""} 240 | 241 | torrents_count_gauge = GaugeMetricFamily( 242 | f"{self.config['metrics_prefix']}_torrents_count", 243 | "Number of torrents", 244 | labels=["status", "category", "server"], 245 | ) 246 | 247 | for category in categories: 248 | category_torrents = self._filter_torrents_by_category(category, torrents) 249 | for state in TorrentStates: 250 | state_torrents = self._filter_torrents_by_state( 251 | state, category_torrents 252 | ) 253 | torrents_count_gauge.add_metric( 254 | value=len(state_torrents), 255 | labels=[state.value, category, self.server], 256 | ) 257 | 258 | return torrents_count_gauge 259 | 260 | 261 | class ShutdownSignalHandler: 262 | def __init__(self): 263 | self.shutdown_count: int = 0 264 | 265 | # Register signal handler 266 | signal.signal(signal.SIGINT, self._on_signal_received) 267 | signal.signal(signal.SIGTERM, self._on_signal_received) 268 | 269 | def is_shutting_down(self): 270 | return self.shutdown_count > 0 271 | 272 | def _on_signal_received(self, signal, frame): 273 | if self.shutdown_count > 1: 274 | logger.warn("Forcibly killing exporter") 275 | sys.exit(1) 276 | logger.info("Exporter is shutting down") 277 | self.shutdown_count += 1 278 | 279 | 280 | def _get_config_value(key: str, default: str = "") -> str: 281 | input_path = os.environ.get("FILE__" + key, None) 282 | if input_path is not None: 283 | try: 284 | with open(input_path, "r") as input_file: 285 | return input_file.read().strip() 286 | except IOError as e: 287 | logger.error(f"Unable to read value for {key} from {input_path}: {str(e)}") 288 | 289 | return os.environ.get(key, default) 290 | 291 | 292 | def get_config() -> dict: 293 | """Loads all config values.""" 294 | return { 295 | "host": _get_config_value("QBITTORRENT_HOST", ""), 296 | "port": _get_config_value("QBITTORRENT_PORT", ""), 297 | "ssl": (_get_config_value("QBITTORRENT_SSL", "False") == "True"), 298 | "url_base": _get_config_value("QBITTORRENT_URL_BASE", ""), 299 | "username": _get_config_value("QBITTORRENT_USER", ""), 300 | "password": _get_config_value("QBITTORRENT_PASS", ""), 301 | "exporter_address": _get_config_value("EXPORTER_ADDRESS", "0.0.0.0"), 302 | "exporter_port": int(_get_config_value("EXPORTER_PORT", "8000")), 303 | "log_level": _get_config_value("EXPORTER_LOG_LEVEL", "INFO"), 304 | "metrics_prefix": _get_config_value("METRICS_PREFIX", "qbittorrent"), 305 | "export_metrics_by_torrent": ( 306 | _get_config_value("EXPORT_METRICS_BY_TORRENT", "False") == "True" 307 | ), 308 | "verify_webui_certificate": ( 309 | _get_config_value("VERIFY_WEBUI_CERTIFICATE", "True") == "True" 310 | ), 311 | } 312 | 313 | 314 | def main(): 315 | # Init logger so it can be used 316 | logHandler = logging.StreamHandler() 317 | formatter = jsonlogger.JsonFormatter( 318 | "%(asctime) %(levelname) %(message)", datefmt="%Y-%m-%d %H:%M:%S" 319 | ) 320 | logHandler.setFormatter(formatter) 321 | logger.addHandler(logHandler) 322 | logger.setLevel("INFO") # default until config is loaded 323 | 324 | config = get_config() 325 | 326 | # set level once config has been loaded 327 | logger.setLevel(config["log_level"]) 328 | 329 | # Register signal handler 330 | signal_handler = ShutdownSignalHandler() 331 | 332 | if not config["host"]: 333 | logger.error( 334 | "No host specified, please set QBITTORRENT_HOST environment variable" 335 | ) 336 | sys.exit(1) 337 | if not config["port"]: 338 | logger.error( 339 | "No port specified, please set QBITTORRENT_PORT environment variable" 340 | ) 341 | sys.exit(1) 342 | 343 | # Register our custom collector 344 | logger.info("Exporter is starting up") 345 | REGISTRY.register(QbittorrentMetricsCollector(config)) # type: ignore 346 | 347 | # Start server 348 | start_http_server(config["exporter_port"], config["exporter_address"]) 349 | logger.info( 350 | f"Exporter listening on {config['exporter_address']}:{config['exporter_port']}" 351 | ) 352 | 353 | while not signal_handler.is_shutting_down(): 354 | time.sleep(1) 355 | 356 | logger.info("Exporter has shutdown") 357 | 358 | 359 | if __name__ == "__main__": 360 | main() 361 | -------------------------------------------------------------------------------- /tests/exporter_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from unittest.mock import MagicMock, patch 3 | 4 | from prometheus_client.metrics_core import CounterMetricFamily, GaugeMetricFamily 5 | from qbittorrentapi import TorrentStates 6 | 7 | from qbittorrent_exporter.exporter import ( 8 | Metric, 9 | MetricType, 10 | QbittorrentMetricsCollector, 11 | ) 12 | 13 | 14 | class TestQbittorrentMetricsCollector(unittest.TestCase): 15 | @patch("qbittorrent_exporter.exporter.Client") 16 | def setUp(self, mock_client): 17 | self.mock_client = mock_client 18 | self.config = { 19 | "host": "localhost", 20 | "port": "8080", 21 | "ssl": False, 22 | "url_base": "qbt/", 23 | "username": "user", 24 | "password": "pass", 25 | "verify_webui_certificate": False, 26 | "metrics_prefix": "qbittorrent", 27 | "export_metrics_by_torrent": True, 28 | } 29 | self.torrentsState = [ 30 | {"name": "Torrent DOWNLOADING 1", "state": TorrentStates.DOWNLOADING}, 31 | {"name": "Torrent UPLOADING 1", "state": TorrentStates.UPLOADING}, 32 | {"name": "Torrent DOWNLOADING 2", "state": TorrentStates.DOWNLOADING}, 33 | {"name": "Torrent UPLOADING 2", "state": TorrentStates.UPLOADING}, 34 | ] 35 | self.torrentsCategories = [ 36 | {"name": "Torrent Movies 1", "category": "Movies"}, 37 | {"name": "Torrent Music 1", "category": "Music"}, 38 | {"name": "Torrent Movies 2", "category": "Movies"}, 39 | {"name": "Torrent unknown", "category": ""}, 40 | {"name": "Torrent Music 2", "category": "Music"}, 41 | {"name": "Torrent Uncategorized 1", "category": "Uncategorized"}, 42 | ] 43 | self.collector = QbittorrentMetricsCollector(self.config) 44 | 45 | def test_init(self): 46 | self.assertEqual(self.collector.config, self.config) 47 | self.mock_client.assert_called_once_with( 48 | host=f"http://{self.config['host']}:{self.config['port']}/qbt/", 49 | username=self.config["username"], 50 | password=self.config["password"], 51 | VERIFY_WEBUI_CERTIFICATE=self.config["verify_webui_certificate"], 52 | ) 53 | 54 | def test_collect_by_torrent_metric_gauges(self): 55 | # Mock the return value of self.client.torrents.info() 56 | self.collector.client.torrents.info.return_value = [ 57 | { 58 | "name": "Torrent 1", 59 | "size": 100, 60 | "category": "category1", 61 | "downloaded": 100, 62 | }, 63 | { 64 | "name": "Torrent 2", 65 | "size": 200, 66 | "category": "category2", 67 | "downloaded": 200, 68 | }, 69 | { 70 | "name": "Torrent 3", 71 | "size": 300, 72 | "category": "category3", 73 | "downloaded": 300, 74 | }, 75 | ] 76 | # Mock the client.torrent_categories.categories attribute 77 | self.collector.client.torrent_categories.categories = { 78 | "category1": {"name": "Category 1"}, 79 | "category2": {"name": "Category 2"}, 80 | "category3": {"name": "Category 3"}, 81 | } 82 | 83 | result = self.collector._get_qbittorrent_by_torrent_metric_gauges() 84 | 85 | torrent_size_metric = result[0] 86 | self.assertIsInstance(torrent_size_metric, GaugeMetricFamily) 87 | self.assertEqual(torrent_size_metric.name, "qbittorrent_torrent_size") 88 | self.assertEqual(torrent_size_metric.documentation, "Size of the torrent") 89 | self.assertEqual( 90 | torrent_size_metric.samples[0].labels, 91 | { 92 | "name": "Torrent 1", 93 | "category": "category1", 94 | "server": "localhost:8080/qbt/", 95 | }, 96 | ) 97 | self.assertEqual(torrent_size_metric.samples[0].value, 100) 98 | 99 | torrent_downloaded_metric = result[1] 100 | self.assertIsInstance(torrent_downloaded_metric, GaugeMetricFamily) 101 | self.assertEqual( 102 | torrent_downloaded_metric.name, "qbittorrent_torrent_downloaded" 103 | ) 104 | self.assertEqual( 105 | torrent_downloaded_metric.documentation, "Downloaded data for the torrent" 106 | ) 107 | self.assertEqual( 108 | torrent_downloaded_metric.samples[0].labels, 109 | { 110 | "name": "Torrent 1", 111 | "category": "category1", 112 | "server": "localhost:8080/qbt/", 113 | }, 114 | ) 115 | self.assertEqual(torrent_downloaded_metric.samples[0].value, 100) 116 | 117 | def test_collect_torrent_tags_metric_gauge(self): 118 | result = self.collector._get_qbittorrent_torrent_tags_metrics_gauge() 119 | 120 | self.assertIsInstance(result, GaugeMetricFamily) 121 | self.assertEqual(result.name, "qbittorrent_torrents_count") 122 | self.assertEqual(result.documentation, "Number of torrents") 123 | self.assertEqual( 124 | result.samples[0].labels, 125 | { 126 | "status": "error", 127 | "category": "Uncategorized", 128 | "server": "localhost:8080/qbt/", 129 | }, 130 | ) 131 | self.assertEqual(result.samples[0].value, 0) 132 | 133 | def test_collect(self): 134 | metrics = list(self.collector.collect()) 135 | self.assertNotEqual(len(metrics), 0) 136 | 137 | def test_fetch_categories(self): 138 | # Mock the client.torrent_categories.categories attribute 139 | self.collector.client.torrent_categories.categories = { 140 | "category1": {"name": "Category 1"}, 141 | "category2": {"name": "Category 2"}, 142 | "category3": {"name": "Category 3"}, 143 | } 144 | 145 | categories = self.collector._fetch_categories() 146 | self.assertIsInstance(categories, dict) 147 | self.assertNotEqual(len(categories), 0) 148 | self.assertEqual(categories["category1"]["name"], "Category 1") 149 | self.assertEqual(categories["category2"]["name"], "Category 2") 150 | self.assertEqual(categories["category3"]["name"], "Category 3") 151 | 152 | def test_fetch_categories_exception(self): 153 | self.collector.client.torrent_categories.categories = Exception( 154 | "Error fetching categories" 155 | ) 156 | categories = self.collector._fetch_categories() 157 | self.assertEqual(categories, {}) 158 | 159 | def test_fetch_torrents_success(self): 160 | # Mock the return value of self.client.torrents.info() 161 | self.collector.client.torrents.info.return_value = [ 162 | {"name": "Torrent 1", "size": 100}, 163 | {"name": "Torrent 2", "size": 200}, 164 | {"name": "Torrent 3", "size": 300}, 165 | ] 166 | 167 | expected_result = [ 168 | {"name": "Torrent 1", "size": 100}, 169 | {"name": "Torrent 2", "size": 200}, 170 | {"name": "Torrent 3", "size": 300}, 171 | ] 172 | 173 | result = self.collector._fetch_torrents() 174 | self.assertEqual(result, expected_result) 175 | 176 | def test_fetch_torrents_exception(self): 177 | # Mock an exception being raised by self.client.torrents.info() 178 | self.collector.client.torrents.info.side_effect = Exception("Connection error") 179 | 180 | expected_result = [] 181 | 182 | result = self.collector._fetch_torrents() 183 | self.assertEqual(result, expected_result) 184 | 185 | def test_filter_torrents_by_state(self): 186 | expected = [ 187 | {"name": "Torrent DOWNLOADING 1", "state": TorrentStates.DOWNLOADING}, 188 | {"name": "Torrent DOWNLOADING 2", "state": TorrentStates.DOWNLOADING}, 189 | ] 190 | result = self.collector._filter_torrents_by_state( 191 | TorrentStates.DOWNLOADING, self.torrentsState 192 | ) 193 | self.assertEqual(result, expected) 194 | 195 | expected = [ 196 | {"name": "Torrent UPLOADING 1", "state": TorrentStates.UPLOADING}, 197 | {"name": "Torrent UPLOADING 2", "state": TorrentStates.UPLOADING}, 198 | ] 199 | result = self.collector._filter_torrents_by_state( 200 | TorrentStates.UPLOADING, self.torrentsState 201 | ) 202 | self.assertEqual(result, expected) 203 | 204 | expected = [] 205 | result = self.collector._filter_torrents_by_state( 206 | TorrentStates.ERROR, self.torrentsState 207 | ) 208 | self.assertEqual(result, expected) 209 | 210 | def test_filter_torrents_by_category(self): 211 | expected_result = [ 212 | {"name": "Torrent Movies 1", "category": "Movies"}, 213 | {"name": "Torrent Movies 2", "category": "Movies"}, 214 | ] 215 | result = self.collector._filter_torrents_by_category( 216 | "Movies", self.torrentsCategories 217 | ) 218 | self.assertEqual(result, expected_result) 219 | 220 | expected_result = [ 221 | {"name": "Torrent unknown", "category": ""}, 222 | {"name": "Torrent Uncategorized 1", "category": "Uncategorized"}, 223 | ] 224 | result = self.collector._filter_torrents_by_category( 225 | "Uncategorized", self.torrentsCategories 226 | ) 227 | self.assertEqual(result, expected_result) 228 | 229 | expected_result = [] 230 | result = self.collector._filter_torrents_by_category( 231 | "Books", self.torrentsCategories 232 | ) 233 | self.assertEqual(result, expected_result) 234 | 235 | def test_get_qbittorrent_status_metrics(self): 236 | self.collector.client.sync_maindata.return_value = { 237 | "server_state": {"connection_status": "connected"} 238 | } 239 | self.collector.client.app.version = "1.2.3" 240 | 241 | expected_metrics = [ 242 | Metric( 243 | name="qbittorrent_up", 244 | value=True, 245 | labels={"version": "1.2.3", "server": "localhost:8080/qbt/"}, 246 | help_text=( 247 | "Whether the qBittorrent server is answering requests from this" 248 | " exporter. A `version` label with the server version is added." 249 | ), 250 | ), 251 | Metric( 252 | name="qbittorrent_connected", 253 | value=True, 254 | labels={"server": "localhost:8080/qbt/"}, 255 | help_text=( 256 | "Whether the qBittorrent server is connected to the Bittorrent" 257 | " network." 258 | ), 259 | ), 260 | Metric( 261 | name="qbittorrent_firewalled", 262 | value=False, 263 | labels={"server": "localhost:8080/qbt/"}, 264 | help_text=( 265 | "Whether the qBittorrent server is connected to the Bittorrent" 266 | " network but is behind a firewall." 267 | ), 268 | ), 269 | Metric( 270 | name="qbittorrent_dht_nodes", 271 | value=0, 272 | labels={"server": "localhost:8080/qbt/"}, 273 | help_text="Number of DHT nodes connected to.", 274 | ), 275 | Metric( 276 | name="qbittorrent_total_peer_connections", 277 | value=0, 278 | labels={"server": "localhost:8080/qbt/"}, 279 | help_text="Total number of peer connections.", 280 | ), 281 | Metric( 282 | name="qbittorrent_dl_info_data", 283 | value=0, 284 | labels={"server": "localhost:8080/qbt/"}, 285 | help_text="Data downloaded since the server started, in bytes.", 286 | metric_type=MetricType.COUNTER, 287 | ), 288 | Metric( 289 | name="qbittorrent_up_info_data", 290 | value=0, 291 | labels={"server": "localhost:8080/qbt/"}, 292 | help_text="Data uploaded since the server started, in bytes.", 293 | metric_type=MetricType.COUNTER, 294 | ), 295 | Metric( 296 | name="qbittorrent_alltime_dl", 297 | value=0, 298 | labels={"server": "localhost:8080/qbt/"}, 299 | help_text="Total historical data downloaded, in bytes.", 300 | metric_type=MetricType.COUNTER, 301 | ), 302 | Metric( 303 | name="qbittorrent_alltime_ul", 304 | value=0, 305 | labels={"server": "localhost:8080/qbt/"}, 306 | help_text="Total historical data uploaded, in bytes.", 307 | metric_type=MetricType.COUNTER, 308 | ), 309 | ] 310 | 311 | metrics = self.collector._get_qbittorrent_status_metrics() 312 | self.assertEqual(metrics, expected_metrics) 313 | 314 | def test_server_string_with_different_settings(self): 315 | self.assertEqual(self.collector.server, "localhost:8080/qbt/") 316 | self.assertEqual(self.collector.connection_string, "http://localhost:8080/qbt/") 317 | 318 | config = { 319 | "host": "qbittorrent.example.com", 320 | "port": "8081", 321 | "ssl": False, 322 | "url_base": "qbittorrent/", 323 | "username": "user", 324 | "password": "pass", 325 | "verify_webui_certificate": False, 326 | "metrics_prefix": "qbittorrent", 327 | } 328 | collector = QbittorrentMetricsCollector(config) 329 | self.assertEqual(collector.server, "qbittorrent.example.com:8081/qbittorrent/") 330 | self.assertEqual( 331 | collector.connection_string, 332 | "http://qbittorrent.example.com:8081/qbittorrent/", 333 | ) 334 | 335 | config = { 336 | "host": "qbittorrent2.example.com", 337 | "port": "8084", 338 | "ssl": True, 339 | "url_base": "", 340 | "username": "user", 341 | "password": "pass", 342 | "verify_webui_certificate": True, 343 | "metrics_prefix": "qbittorrent", 344 | } 345 | collector = QbittorrentMetricsCollector(config) 346 | self.assertEqual(collector.server, "qbittorrent2.example.com:8084") 347 | self.assertEqual( 348 | collector.connection_string, "https://qbittorrent2.example.com:8084" 349 | ) 350 | 351 | config = { 352 | "host": "qbittorrent3.example.com", 353 | "port": "443", 354 | "ssl": False, # Will be enforced to True because port is 443 355 | "url_base": "server/", 356 | "username": "user", 357 | "password": "pass", 358 | "verify_webui_certificate": True, 359 | "metrics_prefix": "qbittorrent", 360 | } 361 | collector = QbittorrentMetricsCollector(config) 362 | self.assertEqual(collector.server, "qbittorrent3.example.com:443/server/") 363 | self.assertEqual( 364 | collector.connection_string, "https://qbittorrent3.example.com:443/server/" 365 | ) 366 | 367 | config = { 368 | "host": "qbittorrent4.example.com", 369 | "port": "443", 370 | "ssl": True, 371 | "url_base": "server/", 372 | "username": "user", 373 | "password": "pass", 374 | "verify_webui_certificate": True, 375 | "metrics_prefix": "qbittorrent", 376 | } 377 | collector = QbittorrentMetricsCollector(config) 378 | self.assertEqual(collector.server, "qbittorrent4.example.com:443/server/") 379 | self.assertEqual( 380 | collector.connection_string, "https://qbittorrent4.example.com:443/server/" 381 | ) 382 | -------------------------------------------------------------------------------- /pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default", "dev"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.5.0" 8 | content_hash = "sha256:20e48d070aea6fe119cbbc98d78384b9f6ad6acb2ab9ee34063d556caa378fbd" 9 | 10 | [[metadata.targets]] 11 | requires_python = ">=3.11" 12 | 13 | [[package]] 14 | name = "black" 15 | version = "24.10.0" 16 | requires_python = ">=3.9" 17 | summary = "The uncompromising code formatter." 18 | dependencies = [ 19 | "click>=8.0.0", 20 | "mypy-extensions>=0.4.3", 21 | "packaging>=22.0", 22 | "pathspec>=0.9.0", 23 | "platformdirs>=2", 24 | "tomli>=1.1.0; python_version < \"3.11\"", 25 | "typing-extensions>=4.0.1; python_version < \"3.11\"", 26 | ] 27 | files = [ 28 | {file = "black-24.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5a2221696a8224e335c28816a9d331a6c2ae15a2ee34ec857dcf3e45dbfa99ad"}, 29 | {file = "black-24.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f9da3333530dbcecc1be13e69c250ed8dfa67f43c4005fb537bb426e19200d50"}, 30 | {file = "black-24.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4007b1393d902b48b36958a216c20c4482f601569d19ed1df294a496eb366392"}, 31 | {file = "black-24.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:394d4ddc64782e51153eadcaaca95144ac4c35e27ef9b0a42e121ae7e57a9175"}, 32 | {file = "black-24.10.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b5e39e0fae001df40f95bd8cc36b9165c5e2ea88900167bddf258bacef9bbdc3"}, 33 | {file = "black-24.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d37d422772111794b26757c5b55a3eade028aa3fde43121ab7b673d050949d65"}, 34 | {file = "black-24.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:14b3502784f09ce2443830e3133dacf2c0110d45191ed470ecb04d0f5f6fcb0f"}, 35 | {file = "black-24.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:30d2c30dc5139211dda799758559d1b049f7f14c580c409d6ad925b74a4208a8"}, 36 | {file = "black-24.10.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1cbacacb19e922a1d75ef2b6ccaefcd6e93a2c05ede32f06a21386a04cedb981"}, 37 | {file = "black-24.10.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1f93102e0c5bb3907451063e08b9876dbeac810e7da5a8bfb7aeb5a9ef89066b"}, 38 | {file = "black-24.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ddacb691cdcdf77b96f549cf9591701d8db36b2f19519373d60d31746068dbf2"}, 39 | {file = "black-24.10.0-cp313-cp313-win_amd64.whl", hash = "sha256:680359d932801c76d2e9c9068d05c6b107f2584b2a5b88831c83962eb9984c1b"}, 40 | {file = "black-24.10.0-py3-none-any.whl", hash = "sha256:3bb2b7a1f7b685f85b11fed1ef10f8a9148bceb49853e47a294a3dd963c1dd7d"}, 41 | {file = "black-24.10.0.tar.gz", hash = "sha256:846ea64c97afe3bc677b761787993be4991810ecc7a4a937816dd6bddedc4875"}, 42 | ] 43 | 44 | [[package]] 45 | name = "certifi" 46 | version = "2024.8.30" 47 | requires_python = ">=3.6" 48 | summary = "Python package for providing Mozilla's CA Bundle." 49 | files = [ 50 | {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, 51 | {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, 52 | ] 53 | 54 | [[package]] 55 | name = "charset-normalizer" 56 | version = "3.4.0" 57 | requires_python = ">=3.7.0" 58 | summary = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." 59 | files = [ 60 | {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0d99dd8ff461990f12d6e42c7347fd9ab2532fb70e9621ba520f9e8637161d7c"}, 61 | {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c57516e58fd17d03ebe67e181a4e4e2ccab1168f8c2976c6a334d4f819fe5944"}, 62 | {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6dba5d19c4dfab08e58d5b36304b3f92f3bd5d42c1a3fa37b5ba5cdf6dfcbcee"}, 63 | {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf4475b82be41b07cc5e5ff94810e6a01f276e37c2d55571e3fe175e467a1a1c"}, 64 | {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce031db0408e487fd2775d745ce30a7cd2923667cf3b69d48d219f1d8f5ddeb6"}, 65 | {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ff4e7cdfdb1ab5698e675ca622e72d58a6fa2a8aa58195de0c0061288e6e3ea"}, 66 | {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3710a9751938947e6327ea9f3ea6332a09bf0ba0c09cae9cb1f250bd1f1549bc"}, 67 | {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:82357d85de703176b5587dbe6ade8ff67f9f69a41c0733cf2425378b49954de5"}, 68 | {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:47334db71978b23ebcf3c0f9f5ee98b8d65992b65c9c4f2d34c2eaf5bcaf0594"}, 69 | {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8ce7fd6767a1cc5a92a639b391891bf1c268b03ec7e021c7d6d902285259685c"}, 70 | {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f1a2f519ae173b5b6a2c9d5fa3116ce16e48b3462c8b96dfdded11055e3d6365"}, 71 | {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:63bc5c4ae26e4bc6be6469943b8253c0fd4e4186c43ad46e713ea61a0ba49129"}, 72 | {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bcb4f8ea87d03bc51ad04add8ceaf9b0f085ac045ab4d74e73bbc2dc033f0236"}, 73 | {file = "charset_normalizer-3.4.0-cp311-cp311-win32.whl", hash = "sha256:9ae4ef0b3f6b41bad6366fb0ea4fc1d7ed051528e113a60fa2a65a9abb5b1d99"}, 74 | {file = "charset_normalizer-3.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cee4373f4d3ad28f1ab6290684d8e2ebdb9e7a1b74fdc39e4c211995f77bec27"}, 75 | {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0713f3adb9d03d49d365b70b84775d0a0d18e4ab08d12bc46baa6132ba78aaf6"}, 76 | {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:de7376c29d95d6719048c194a9cf1a1b0393fbe8488a22008610b0361d834ecf"}, 77 | {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4a51b48f42d9358460b78725283f04bddaf44a9358197b889657deba38f329db"}, 78 | {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b295729485b06c1a0683af02a9e42d2caa9db04a373dc38a6a58cdd1e8abddf1"}, 79 | {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ee803480535c44e7f5ad00788526da7d85525cfefaf8acf8ab9a310000be4b03"}, 80 | {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3d59d125ffbd6d552765510e3f31ed75ebac2c7470c7274195b9161a32350284"}, 81 | {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8cda06946eac330cbe6598f77bb54e690b4ca93f593dee1568ad22b04f347c15"}, 82 | {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07afec21bbbbf8a5cc3651aa96b980afe2526e7f048fdfb7f1014d84acc8b6d8"}, 83 | {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6b40e8d38afe634559e398cc32b1472f376a4099c75fe6299ae607e404c033b2"}, 84 | {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b8dcd239c743aa2f9c22ce674a145e0a25cb1566c495928440a181ca1ccf6719"}, 85 | {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:84450ba661fb96e9fd67629b93d2941c871ca86fc38d835d19d4225ff946a631"}, 86 | {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:44aeb140295a2f0659e113b31cfe92c9061622cadbc9e2a2f7b8ef6b1e29ef4b"}, 87 | {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1db4e7fefefd0f548d73e2e2e041f9df5c59e178b4c72fbac4cc6f535cfb1565"}, 88 | {file = "charset_normalizer-3.4.0-cp312-cp312-win32.whl", hash = "sha256:5726cf76c982532c1863fb64d8c6dd0e4c90b6ece9feb06c9f202417a31f7dd7"}, 89 | {file = "charset_normalizer-3.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:b197e7094f232959f8f20541ead1d9862ac5ebea1d58e9849c1bf979255dfac9"}, 90 | {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:dd4eda173a9fcccb5f2e2bd2a9f423d180194b1bf17cf59e3269899235b2a114"}, 91 | {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9e3c4c9e1ed40ea53acf11e2a386383c3304212c965773704e4603d589343ed"}, 92 | {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:92a7e36b000bf022ef3dbb9c46bfe2d52c047d5e3f3343f43204263c5addc250"}, 93 | {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54b6a92d009cbe2fb11054ba694bc9e284dad30a26757b1e372a1fdddaf21920"}, 94 | {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ffd9493de4c922f2a38c2bf62b831dcec90ac673ed1ca182fe11b4d8e9f2a64"}, 95 | {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:35c404d74c2926d0287fbd63ed5d27eb911eb9e4a3bb2c6d294f3cfd4a9e0c23"}, 96 | {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4796efc4faf6b53a18e3d46343535caed491776a22af773f366534056c4e1fbc"}, 97 | {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7fdd52961feb4c96507aa649550ec2a0d527c086d284749b2f582f2d40a2e0d"}, 98 | {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:92db3c28b5b2a273346bebb24857fda45601aef6ae1c011c0a997106581e8a88"}, 99 | {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ab973df98fc99ab39080bfb0eb3a925181454d7c3ac8a1e695fddfae696d9e90"}, 100 | {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:4b67fdab07fdd3c10bb21edab3cbfe8cf5696f453afce75d815d9d7223fbe88b"}, 101 | {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:aa41e526a5d4a9dfcfbab0716c7e8a1b215abd3f3df5a45cf18a12721d31cb5d"}, 102 | {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ffc519621dce0c767e96b9c53f09c5d215578e10b02c285809f76509a3931482"}, 103 | {file = "charset_normalizer-3.4.0-cp313-cp313-win32.whl", hash = "sha256:f19c1585933c82098c2a520f8ec1227f20e339e33aca8fa6f956f6691b784e67"}, 104 | {file = "charset_normalizer-3.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:707b82d19e65c9bd28b81dde95249b07bf9f5b90ebe1ef17d9b57473f8a64b7b"}, 105 | {file = "charset_normalizer-3.4.0-py3-none-any.whl", hash = "sha256:fe9f97feb71aa9896b81973a7bbada8c49501dc73e58a10fcef6663af95e5079"}, 106 | {file = "charset_normalizer-3.4.0.tar.gz", hash = "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e"}, 107 | ] 108 | 109 | [[package]] 110 | name = "click" 111 | version = "8.1.7" 112 | requires_python = ">=3.7" 113 | summary = "Composable command line interface toolkit" 114 | dependencies = [ 115 | "colorama; platform_system == \"Windows\"", 116 | "importlib-metadata; python_version < \"3.8\"", 117 | ] 118 | files = [ 119 | {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, 120 | {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, 121 | ] 122 | 123 | [[package]] 124 | name = "colorama" 125 | version = "0.4.6" 126 | requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" 127 | summary = "Cross-platform colored terminal text." 128 | files = [ 129 | {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, 130 | {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, 131 | ] 132 | 133 | [[package]] 134 | name = "coverage" 135 | version = "7.6.4" 136 | requires_python = ">=3.9" 137 | summary = "Code coverage measurement for Python" 138 | files = [ 139 | {file = "coverage-7.6.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:73d2b73584446e66ee633eaad1a56aad577c077f46c35ca3283cd687b7715b0b"}, 140 | {file = "coverage-7.6.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:51b44306032045b383a7a8a2c13878de375117946d68dcb54308111f39775a25"}, 141 | {file = "coverage-7.6.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0b3fb02fe73bed561fa12d279a417b432e5b50fe03e8d663d61b3d5990f29546"}, 142 | {file = "coverage-7.6.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ed8fe9189d2beb6edc14d3ad19800626e1d9f2d975e436f84e19efb7fa19469b"}, 143 | {file = "coverage-7.6.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b369ead6527d025a0fe7bd3864e46dbee3aa8f652d48df6174f8d0bac9e26e0e"}, 144 | {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:ade3ca1e5f0ff46b678b66201f7ff477e8fa11fb537f3b55c3f0568fbfe6e718"}, 145 | {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:27fb4a050aaf18772db513091c9c13f6cb94ed40eacdef8dad8411d92d9992db"}, 146 | {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4f704f0998911abf728a7783799444fcbbe8261c4a6c166f667937ae6a8aa522"}, 147 | {file = "coverage-7.6.4-cp311-cp311-win32.whl", hash = "sha256:29155cd511ee058e260db648b6182c419422a0d2e9a4fa44501898cf918866cf"}, 148 | {file = "coverage-7.6.4-cp311-cp311-win_amd64.whl", hash = "sha256:8902dd6a30173d4ef09954bfcb24b5d7b5190cf14a43170e386979651e09ba19"}, 149 | {file = "coverage-7.6.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:12394842a3a8affa3ba62b0d4ab7e9e210c5e366fbac3e8b2a68636fb19892c2"}, 150 | {file = "coverage-7.6.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2b6b4c83d8e8ea79f27ab80778c19bc037759aea298da4b56621f4474ffeb117"}, 151 | {file = "coverage-7.6.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d5b8007f81b88696d06f7df0cb9af0d3b835fe0c8dbf489bad70b45f0e45613"}, 152 | {file = "coverage-7.6.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b57b768feb866f44eeed9f46975f3d6406380275c5ddfe22f531a2bf187eda27"}, 153 | {file = "coverage-7.6.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5915fcdec0e54ee229926868e9b08586376cae1f5faa9bbaf8faf3561b393d52"}, 154 | {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0b58c672d14f16ed92a48db984612f5ce3836ae7d72cdd161001cc54512571f2"}, 155 | {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:2fdef0d83a2d08d69b1f2210a93c416d54e14d9eb398f6ab2f0a209433db19e1"}, 156 | {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8cf717ee42012be8c0cb205dbbf18ffa9003c4cbf4ad078db47b95e10748eec5"}, 157 | {file = "coverage-7.6.4-cp312-cp312-win32.whl", hash = "sha256:7bb92c539a624cf86296dd0c68cd5cc286c9eef2d0c3b8b192b604ce9de20a17"}, 158 | {file = "coverage-7.6.4-cp312-cp312-win_amd64.whl", hash = "sha256:1032e178b76a4e2b5b32e19d0fd0abbce4b58e77a1ca695820d10e491fa32b08"}, 159 | {file = "coverage-7.6.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:023bf8ee3ec6d35af9c1c6ccc1d18fa69afa1cb29eaac57cb064dbb262a517f9"}, 160 | {file = "coverage-7.6.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:b0ac3d42cb51c4b12df9c5f0dd2f13a4f24f01943627120ec4d293c9181219ba"}, 161 | {file = "coverage-7.6.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f8fe4984b431f8621ca53d9380901f62bfb54ff759a1348cd140490ada7b693c"}, 162 | {file = "coverage-7.6.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5fbd612f8a091954a0c8dd4c0b571b973487277d26476f8480bfa4b2a65b5d06"}, 163 | {file = "coverage-7.6.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dacbc52de979f2823a819571f2e3a350a7e36b8cb7484cdb1e289bceaf35305f"}, 164 | {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:dab4d16dfef34b185032580e2f2f89253d302facba093d5fa9dbe04f569c4f4b"}, 165 | {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:862264b12ebb65ad8d863d51f17758b1684560b66ab02770d4f0baf2ff75da21"}, 166 | {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5beb1ee382ad32afe424097de57134175fea3faf847b9af002cc7895be4e2a5a"}, 167 | {file = "coverage-7.6.4-cp313-cp313-win32.whl", hash = "sha256:bf20494da9653f6410213424f5f8ad0ed885e01f7e8e59811f572bdb20b8972e"}, 168 | {file = "coverage-7.6.4-cp313-cp313-win_amd64.whl", hash = "sha256:182e6cd5c040cec0a1c8d415a87b67ed01193ed9ad458ee427741c7d8513d963"}, 169 | {file = "coverage-7.6.4-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:a181e99301a0ae128493a24cfe5cfb5b488c4e0bf2f8702091473d033494d04f"}, 170 | {file = "coverage-7.6.4-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:df57bdbeffe694e7842092c5e2e0bc80fff7f43379d465f932ef36f027179806"}, 171 | {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0bcd1069e710600e8e4cf27f65c90c7843fa8edfb4520fb0ccb88894cad08b11"}, 172 | {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:99b41d18e6b2a48ba949418db48159d7a2e81c5cc290fc934b7d2380515bd0e3"}, 173 | {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6b1e54712ba3474f34b7ef7a41e65bd9037ad47916ccb1cc78769bae324c01a"}, 174 | {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:53d202fd109416ce011578f321460795abfe10bb901b883cafd9b3ef851bacfc"}, 175 | {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:c48167910a8f644671de9f2083a23630fbf7a1cb70ce939440cd3328e0919f70"}, 176 | {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:cc8ff50b50ce532de2fa7a7daae9dd12f0a699bfcd47f20945364e5c31799fef"}, 177 | {file = "coverage-7.6.4-cp313-cp313t-win32.whl", hash = "sha256:b8d3a03d9bfcaf5b0141d07a88456bb6a4c3ce55c080712fec8418ef3610230e"}, 178 | {file = "coverage-7.6.4-cp313-cp313t-win_amd64.whl", hash = "sha256:f3ddf056d3ebcf6ce47bdaf56142af51bb7fad09e4af310241e9db7a3a8022e1"}, 179 | {file = "coverage-7.6.4.tar.gz", hash = "sha256:29fc0f17b1d3fea332f8001d4558f8214af7f1d87a345f3a133c901d60347c73"}, 180 | ] 181 | 182 | [[package]] 183 | name = "idna" 184 | version = "3.10" 185 | requires_python = ">=3.6" 186 | summary = "Internationalized Domain Names in Applications (IDNA)" 187 | files = [ 188 | {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, 189 | {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, 190 | ] 191 | 192 | [[package]] 193 | name = "iniconfig" 194 | version = "2.0.0" 195 | requires_python = ">=3.7" 196 | summary = "brain-dead simple config-ini parsing" 197 | files = [ 198 | {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, 199 | {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, 200 | ] 201 | 202 | [[package]] 203 | name = "isort" 204 | version = "5.13.2" 205 | requires_python = ">=3.8.0" 206 | summary = "A Python utility / library to sort Python imports." 207 | files = [ 208 | {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, 209 | {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, 210 | ] 211 | 212 | [[package]] 213 | name = "mypy-extensions" 214 | version = "1.0.0" 215 | requires_python = ">=3.5" 216 | summary = "Type system extensions for programs checked with the mypy type checker." 217 | files = [ 218 | {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, 219 | {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, 220 | ] 221 | 222 | [[package]] 223 | name = "packaging" 224 | version = "24.1" 225 | requires_python = ">=3.8" 226 | summary = "Core utilities for Python packages" 227 | files = [ 228 | {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, 229 | {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, 230 | ] 231 | 232 | [[package]] 233 | name = "pathspec" 234 | version = "0.12.1" 235 | requires_python = ">=3.8" 236 | summary = "Utility library for gitignore style pattern matching of file paths." 237 | files = [ 238 | {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, 239 | {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, 240 | ] 241 | 242 | [[package]] 243 | name = "platformdirs" 244 | version = "4.3.6" 245 | requires_python = ">=3.8" 246 | summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." 247 | files = [ 248 | {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, 249 | {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, 250 | ] 251 | 252 | [[package]] 253 | name = "pluggy" 254 | version = "1.5.0" 255 | requires_python = ">=3.8" 256 | summary = "plugin and hook calling mechanisms for python" 257 | files = [ 258 | {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, 259 | {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, 260 | ] 261 | 262 | [[package]] 263 | name = "prometheus-client" 264 | version = "0.21.0" 265 | requires_python = ">=3.8" 266 | summary = "Python client for the Prometheus monitoring system." 267 | files = [ 268 | {file = "prometheus_client-0.21.0-py3-none-any.whl", hash = "sha256:4fa6b4dd0ac16d58bb587c04b1caae65b8c5043e85f778f42f5f632f6af2e166"}, 269 | {file = "prometheus_client-0.21.0.tar.gz", hash = "sha256:96c83c606b71ff2b0a433c98889d275f51ffec6c5e267de37c7a2b5c9aa9233e"}, 270 | ] 271 | 272 | [[package]] 273 | name = "pytest" 274 | version = "8.3.3" 275 | requires_python = ">=3.8" 276 | summary = "pytest: simple powerful testing with Python" 277 | dependencies = [ 278 | "colorama; sys_platform == \"win32\"", 279 | "exceptiongroup>=1.0.0rc8; python_version < \"3.11\"", 280 | "iniconfig", 281 | "packaging", 282 | "pluggy<2,>=1.5", 283 | "tomli>=1; python_version < \"3.11\"", 284 | ] 285 | files = [ 286 | {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"}, 287 | {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"}, 288 | ] 289 | 290 | [[package]] 291 | name = "python-json-logger" 292 | version = "2.0.7" 293 | requires_python = ">=3.6" 294 | summary = "A python library adding a json log formatter" 295 | files = [ 296 | {file = "python-json-logger-2.0.7.tar.gz", hash = "sha256:23e7ec02d34237c5aa1e29a070193a4ea87583bb4e7f8fd06d3de8264c4b2e1c"}, 297 | {file = "python_json_logger-2.0.7-py3-none-any.whl", hash = "sha256:f380b826a991ebbe3de4d897aeec42760035ac760345e57b812938dc8b35e2bd"}, 298 | ] 299 | 300 | [[package]] 301 | name = "qbittorrent-api" 302 | version = "2024.9.67" 303 | requires_python = ">=3.8" 304 | summary = "Python client for qBittorrent v4.1+ Web API." 305 | dependencies = [ 306 | "packaging", 307 | "requests>=2.16.0", 308 | "urllib3>=1.24.2", 309 | ] 310 | files = [ 311 | {file = "qbittorrent_api-2024.9.67-py3-none-any.whl", hash = "sha256:79cd3f31ff64a4520501d184637787024ad0339926a76b159b95a67a8fa81e1d"}, 312 | {file = "qbittorrent_api-2024.9.67.tar.gz", hash = "sha256:f8d7edb71b14ccd560d182fa1f450b7836ffc686ccbd4786c1663f7a037d6966"}, 313 | ] 314 | 315 | [[package]] 316 | name = "requests" 317 | version = "2.32.3" 318 | requires_python = ">=3.8" 319 | summary = "Python HTTP for Humans." 320 | dependencies = [ 321 | "certifi>=2017.4.17", 322 | "charset-normalizer<4,>=2", 323 | "idna<4,>=2.5", 324 | "urllib3<3,>=1.21.1", 325 | ] 326 | files = [ 327 | {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"}, 328 | {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"}, 329 | ] 330 | 331 | [[package]] 332 | name = "ruff" 333 | version = "0.7.1" 334 | requires_python = ">=3.7" 335 | summary = "An extremely fast Python linter and code formatter, written in Rust." 336 | files = [ 337 | {file = "ruff-0.7.1-py3-none-linux_armv6l.whl", hash = "sha256:cb1bc5ed9403daa7da05475d615739cc0212e861b7306f314379d958592aaa89"}, 338 | {file = "ruff-0.7.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:27c1c52a8d199a257ff1e5582d078eab7145129aa02721815ca8fa4f9612dc35"}, 339 | {file = "ruff-0.7.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:588a34e1ef2ea55b4ddfec26bbe76bc866e92523d8c6cdec5e8aceefeff02d99"}, 340 | {file = "ruff-0.7.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94fc32f9cdf72dc75c451e5f072758b118ab8100727168a3df58502b43a599ca"}, 341 | {file = "ruff-0.7.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:985818742b833bffa543a84d1cc11b5e6871de1b4e0ac3060a59a2bae3969250"}, 342 | {file = "ruff-0.7.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:32f1e8a192e261366c702c5fb2ece9f68d26625f198a25c408861c16dc2dea9c"}, 343 | {file = "ruff-0.7.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:699085bf05819588551b11751eff33e9ca58b1b86a6843e1b082a7de40da1565"}, 344 | {file = "ruff-0.7.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:344cc2b0814047dc8c3a8ff2cd1f3d808bb23c6658db830d25147339d9bf9ea7"}, 345 | {file = "ruff-0.7.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4316bbf69d5a859cc937890c7ac7a6551252b6a01b1d2c97e8fc96e45a7c8b4a"}, 346 | {file = "ruff-0.7.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:79d3af9dca4c56043e738a4d6dd1e9444b6d6c10598ac52d146e331eb155a8ad"}, 347 | {file = "ruff-0.7.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c5c121b46abde94a505175524e51891f829414e093cd8326d6e741ecfc0a9112"}, 348 | {file = "ruff-0.7.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8422104078324ea250886954e48f1373a8fe7de59283d747c3a7eca050b4e378"}, 349 | {file = "ruff-0.7.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:56aad830af8a9db644e80098fe4984a948e2b6fc2e73891538f43bbe478461b8"}, 350 | {file = "ruff-0.7.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:658304f02f68d3a83c998ad8bf91f9b4f53e93e5412b8f2388359d55869727fd"}, 351 | {file = "ruff-0.7.1-py3-none-win32.whl", hash = "sha256:b517a2011333eb7ce2d402652ecaa0ac1a30c114fbbd55c6b8ee466a7f600ee9"}, 352 | {file = "ruff-0.7.1-py3-none-win_amd64.whl", hash = "sha256:f38c41fcde1728736b4eb2b18850f6d1e3eedd9678c914dede554a70d5241307"}, 353 | {file = "ruff-0.7.1-py3-none-win_arm64.whl", hash = "sha256:19aa200ec824c0f36d0c9114c8ec0087082021732979a359d6f3c390a6ff2a37"}, 354 | {file = "ruff-0.7.1.tar.gz", hash = "sha256:9d8a41d4aa2dad1575adb98a82870cf5db5f76b2938cf2206c22c940034a36f4"}, 355 | ] 356 | 357 | [[package]] 358 | name = "urllib3" 359 | version = "2.2.3" 360 | requires_python = ">=3.8" 361 | summary = "HTTP library with thread-safe connection pooling, file post, and more." 362 | files = [ 363 | {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, 364 | {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, 365 | ] 366 | -------------------------------------------------------------------------------- /grafana/dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "DS_PROMETHEUS", 5 | "label": "Prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__elements": {}, 13 | "__requires": [ 14 | { 15 | "type": "panel", 16 | "id": "gauge", 17 | "name": "Gauge", 18 | "version": "" 19 | }, 20 | { 21 | "type": "grafana", 22 | "id": "grafana", 23 | "name": "Grafana", 24 | "version": "10.2.3" 25 | }, 26 | { 27 | "type": "panel", 28 | "id": "piechart", 29 | "name": "Pie chart", 30 | "version": "" 31 | }, 32 | { 33 | "type": "datasource", 34 | "id": "prometheus", 35 | "name": "Prometheus", 36 | "version": "1.0.0" 37 | }, 38 | { 39 | "type": "panel", 40 | "id": "stat", 41 | "name": "Stat", 42 | "version": "" 43 | }, 44 | { 45 | "type": "panel", 46 | "id": "timeseries", 47 | "name": "Time series", 48 | "version": "" 49 | } 50 | ], 51 | "annotations": { 52 | "list": [ 53 | { 54 | "builtIn": 1, 55 | "datasource": { 56 | "type": "datasource", 57 | "uid": "grafana" 58 | }, 59 | "enable": true, 60 | "hide": true, 61 | "iconColor": "rgba(0, 211, 255, 1)", 62 | "name": "Annotations & Alerts", 63 | "target": { 64 | "limit": 100, 65 | "matchAny": false, 66 | "tags": [], 67 | "type": "dashboard" 68 | }, 69 | "type": "dashboard" 70 | } 71 | ] 72 | }, 73 | "editable": true, 74 | "fiscalYearStartMonth": 0, 75 | "graphTooltip": 0, 76 | "id": null, 77 | "links": [], 78 | "liveNow": false, 79 | "panels": [ 80 | { 81 | "datasource": { 82 | "type": "prometheus", 83 | "uid": "${DS_PROMETHEUS}" 84 | }, 85 | "fieldConfig": { 86 | "defaults": { 87 | "mappings": [ 88 | { 89 | "options": { 90 | "0": { 91 | "text": "Offline" 92 | }, 93 | "1": { 94 | "text": "Online" 95 | } 96 | }, 97 | "type": "value" 98 | }, 99 | { 100 | "options": { 101 | "match": "null", 102 | "result": { 103 | "text": "Unknown" 104 | } 105 | }, 106 | "type": "special" 107 | } 108 | ], 109 | "thresholds": { 110 | "mode": "absolute", 111 | "steps": [ 112 | { 113 | "color": "yellow", 114 | "value": null 115 | }, 116 | { 117 | "color": "semi-dark-red", 118 | "value": 0 119 | }, 120 | { 121 | "color": "semi-dark-green", 122 | "value": 1 123 | } 124 | ] 125 | } 126 | }, 127 | "overrides": [] 128 | }, 129 | "gridPos": { 130 | "h": 4, 131 | "w": 3, 132 | "x": 0, 133 | "y": 0 134 | }, 135 | "id": 2, 136 | "options": { 137 | "colorMode": "value", 138 | "graphMode": "area", 139 | "justifyMode": "auto", 140 | "orientation": "auto", 141 | "reduceOptions": { 142 | "calcs": [ 143 | "last" 144 | ], 145 | "fields": "", 146 | "values": false 147 | }, 148 | "textMode": "auto", 149 | "wideLayout": true 150 | }, 151 | "pluginVersion": "10.2.3", 152 | "targets": [ 153 | { 154 | "datasource": { 155 | "type": "prometheus", 156 | "uid": "${DS_PROMETHEUS}" 157 | }, 158 | "editorMode": "code", 159 | "expr": "qbittorrent_up{server=\"$server\"}", 160 | "format": "time_series", 161 | "instant": false, 162 | "interval": "", 163 | "legendFormat": "", 164 | "refId": "A" 165 | } 166 | ], 167 | "title": "Qbittorrent Status", 168 | "transformations": [], 169 | "type": "stat" 170 | }, 171 | { 172 | "datasource": { 173 | "type": "prometheus", 174 | "uid": "${DS_PROMETHEUS}" 175 | }, 176 | "fieldConfig": { 177 | "defaults": { 178 | "mappings": [ 179 | { 180 | "options": { 181 | "0": { 182 | "text": "Disconnected" 183 | }, 184 | "1": { 185 | "text": "Connected" 186 | }, 187 | "-1": { 188 | "text": "Firewalled" 189 | } 190 | }, 191 | "type": "value" 192 | } 193 | ], 194 | "thresholds": { 195 | "mode": "absolute", 196 | "steps": [ 197 | { 198 | "color": "yellow", 199 | "value": null 200 | }, 201 | { 202 | "color": "dark-red", 203 | "value": 0 204 | }, 205 | { 206 | "color": "semi-dark-green", 207 | "value": 1 208 | } 209 | ] 210 | } 211 | }, 212 | "overrides": [] 213 | }, 214 | "gridPos": { 215 | "h": 4, 216 | "w": 3, 217 | "x": 3, 218 | "y": 0 219 | }, 220 | "id": 3, 221 | "options": { 222 | "colorMode": "value", 223 | "graphMode": "none", 224 | "justifyMode": "auto", 225 | "orientation": "auto", 226 | "reduceOptions": { 227 | "calcs": [ 228 | "lastNotNull" 229 | ], 230 | "fields": "", 231 | "values": false 232 | }, 233 | "textMode": "auto", 234 | "wideLayout": true 235 | }, 236 | "pluginVersion": "10.2.3", 237 | "targets": [ 238 | { 239 | "datasource": { 240 | "type": "prometheus", 241 | "uid": "${DS_PROMETHEUS}" 242 | }, 243 | "editorMode": "code", 244 | "expr": "qbittorrent_connected{server=\"$server\"} - qbittorrent_firewalled{server=\"$server\"}", 245 | "format": "time_series", 246 | "instant": true, 247 | "interval": "", 248 | "legendFormat": "Status", 249 | "refId": "A" 250 | } 251 | ], 252 | "title": "Bittorrent network", 253 | "transformations": [], 254 | "type": "stat" 255 | }, 256 | { 257 | "datasource": { 258 | "type": "prometheus", 259 | "uid": "${DS_PROMETHEUS}" 260 | }, 261 | "fieldConfig": { 262 | "defaults": { 263 | "mappings": [ 264 | { 265 | "options": { 266 | "0": { 267 | "text": "No DHT" 268 | }, 269 | "-1": { 270 | "text": "Firewalled" 271 | } 272 | }, 273 | "type": "value" 274 | } 275 | ], 276 | "thresholds": { 277 | "mode": "absolute", 278 | "steps": [ 279 | { 280 | "color": "yellow", 281 | "value": null 282 | }, 283 | { 284 | "color": "dark-red", 285 | "value": 0 286 | }, 287 | { 288 | "color": "semi-dark-green", 289 | "value": 100 290 | } 291 | ] 292 | } 293 | }, 294 | "overrides": [] 295 | }, 296 | "gridPos": { 297 | "h": 4, 298 | "w": 3, 299 | "x": 6, 300 | "y": 0 301 | }, 302 | "id": 13, 303 | "options": { 304 | "colorMode": "value", 305 | "graphMode": "none", 306 | "justifyMode": "auto", 307 | "orientation": "auto", 308 | "reduceOptions": { 309 | "calcs": [ 310 | "lastNotNull" 311 | ], 312 | "fields": "", 313 | "values": false 314 | }, 315 | "textMode": "auto", 316 | "wideLayout": true 317 | }, 318 | "pluginVersion": "10.2.3", 319 | "targets": [ 320 | { 321 | "datasource": { 322 | "type": "prometheus", 323 | "uid": "${DS_PROMETHEUS}" 324 | }, 325 | "editorMode": "code", 326 | "expr": "qbittorrent_dht_nodes{server=\"$server\"}", 327 | "instant": true, 328 | "interval": "", 329 | "legendFormat": "DHT nodes", 330 | "refId": "B" 331 | } 332 | ], 333 | "title": "DHT nodes", 334 | "transformations": [], 335 | "type": "stat" 336 | }, 337 | { 338 | "datasource": { 339 | "type": "prometheus", 340 | "uid": "${DS_PROMETHEUS}" 341 | }, 342 | "fieldConfig": { 343 | "defaults": { 344 | "mappings": [], 345 | "thresholds": { 346 | "mode": "absolute", 347 | "steps": [ 348 | { 349 | "color": "green", 350 | "value": null 351 | } 352 | ] 353 | }, 354 | "unit": "bytes" 355 | }, 356 | "overrides": [] 357 | }, 358 | "gridPos": { 359 | "h": 4, 360 | "w": 3, 361 | "x": 9, 362 | "y": 0 363 | }, 364 | "id": 6, 365 | "options": { 366 | "colorMode": "value", 367 | "graphMode": "none", 368 | "justifyMode": "auto", 369 | "orientation": "auto", 370 | "reduceOptions": { 371 | "calcs": [ 372 | "last" 373 | ], 374 | "fields": "", 375 | "values": false 376 | }, 377 | "textMode": "auto", 378 | "wideLayout": true 379 | }, 380 | "pluginVersion": "10.2.3", 381 | "targets": [ 382 | { 383 | "datasource": { 384 | "type": "prometheus", 385 | "uid": "${DS_PROMETHEUS}" 386 | }, 387 | "editorMode": "code", 388 | "expr": "sum by (app) (qbittorrent_up_info_data_total{server=\"$server\"})", 389 | "instant": false, 390 | "interval": "", 391 | "legendFormat": "In session ", 392 | "refId": "A" 393 | }, 394 | { 395 | "datasource": { 396 | "type": "prometheus", 397 | "uid": "${DS_PROMETHEUS}" 398 | }, 399 | "editorMode": "code", 400 | "expr": "sum by (app) (qbittorrent_alltime_ul_total{server=\"$server\"})", 401 | "hide": false, 402 | "instant": false, 403 | "legendFormat": "All time", 404 | "range": true, 405 | "refId": "B" 406 | } 407 | ], 408 | "title": "Data uploaded", 409 | "type": "stat" 410 | }, 411 | { 412 | "datasource": { 413 | "type": "prometheus", 414 | "uid": "${DS_PROMETHEUS}" 415 | }, 416 | "fieldConfig": { 417 | "defaults": { 418 | "mappings": [], 419 | "thresholds": { 420 | "mode": "absolute", 421 | "steps": [ 422 | { 423 | "color": "green", 424 | "value": null 425 | } 426 | ] 427 | }, 428 | "unit": "bytes" 429 | }, 430 | "overrides": [] 431 | }, 432 | "gridPos": { 433 | "h": 4, 434 | "w": 3, 435 | "x": 12, 436 | "y": 0 437 | }, 438 | "id": 5, 439 | "options": { 440 | "colorMode": "value", 441 | "graphMode": "none", 442 | "justifyMode": "auto", 443 | "orientation": "auto", 444 | "reduceOptions": { 445 | "calcs": [ 446 | "last" 447 | ], 448 | "fields": "", 449 | "values": false 450 | }, 451 | "textMode": "auto", 452 | "wideLayout": true 453 | }, 454 | "pluginVersion": "10.2.3", 455 | "targets": [ 456 | { 457 | "datasource": { 458 | "type": "prometheus", 459 | "uid": "${DS_PROMETHEUS}" 460 | }, 461 | "editorMode": "code", 462 | "expr": "sum by (app) (qbittorrent_dl_info_data_total{server=\"$server\"})", 463 | "instant": false, 464 | "interval": "", 465 | "legendFormat": " In session", 466 | "refId": "A" 467 | }, 468 | { 469 | "datasource": { 470 | "type": "prometheus", 471 | "uid": "${DS_PROMETHEUS}" 472 | }, 473 | "editorMode": "code", 474 | "expr": "sum by (app) (qbittorrent_alltime_dl_total{server=\"$server\"})", 475 | "hide": false, 476 | "instant": false, 477 | "legendFormat": "All time", 478 | "range": true, 479 | "refId": "B" 480 | } 481 | ], 482 | "title": "Data downloaded", 483 | "type": "stat" 484 | }, 485 | { 486 | "datasource": { 487 | "type": "prometheus", 488 | "uid": "${DS_PROMETHEUS}" 489 | }, 490 | "fieldConfig": { 491 | "defaults": { 492 | "mappings": [], 493 | "thresholds": { 494 | "mode": "absolute", 495 | "steps": [ 496 | { 497 | "color": "green", 498 | "value": null 499 | } 500 | ] 501 | }, 502 | "unit": "none" 503 | }, 504 | "overrides": [] 505 | }, 506 | "gridPos": { 507 | "h": 4, 508 | "w": 3, 509 | "x": 15, 510 | "y": 0 511 | }, 512 | "id": 7, 513 | "options": { 514 | "colorMode": "value", 515 | "graphMode": "area", 516 | "justifyMode": "auto", 517 | "orientation": "auto", 518 | "reduceOptions": { 519 | "calcs": [ 520 | "last" 521 | ], 522 | "fields": "", 523 | "values": false 524 | }, 525 | "textMode": "auto", 526 | "wideLayout": true 527 | }, 528 | "pluginVersion": "10.2.3", 529 | "targets": [ 530 | { 531 | "datasource": { 532 | "type": "prometheus", 533 | "uid": "${DS_PROMETHEUS}" 534 | }, 535 | "editorMode": "code", 536 | "expr": "(sum by (app) (qbittorrent_alltime_ul_total{server=\"$server\"})) / (sum by (app) (qbittorrent_alltime_dl_total{server=\"$server\"}))", 537 | "instant": false, 538 | "interval": "", 539 | "legendFormat": "{{label_name}}", 540 | "refId": "A" 541 | } 542 | ], 543 | "title": "Accumulated ratio in session", 544 | "type": "stat" 545 | }, 546 | { 547 | "datasource": { 548 | "type": "prometheus", 549 | "uid": "${DS_PROMETHEUS}" 550 | }, 551 | "fieldConfig": { 552 | "defaults": { 553 | "decimals": 1, 554 | "mappings": [], 555 | "max": 48000000, 556 | "min": 0, 557 | "thresholds": { 558 | "mode": "absolute", 559 | "steps": [ 560 | { 561 | "color": "dark-red", 562 | "value": null 563 | }, 564 | { 565 | "color": "dark-green", 566 | "value": 8000000 567 | } 568 | ] 569 | }, 570 | "unit": "binBps" 571 | }, 572 | "overrides": [] 573 | }, 574 | "gridPos": { 575 | "h": 4, 576 | "w": 3, 577 | "x": 18, 578 | "y": 0 579 | }, 580 | "id": 16, 581 | "options": { 582 | "minVizHeight": 200, 583 | "minVizWidth": 200, 584 | "orientation": "auto", 585 | "reduceOptions": { 586 | "calcs": [ 587 | "last" 588 | ], 589 | "fields": "", 590 | "values": false 591 | }, 592 | "showThresholdLabels": false, 593 | "showThresholdMarkers": true, 594 | "sizing": "auto" 595 | }, 596 | "pluginVersion": "10.2.3", 597 | "targets": [ 598 | { 599 | "datasource": { 600 | "type": "prometheus", 601 | "uid": "${DS_PROMETHEUS}" 602 | }, 603 | "editorMode": "code", 604 | "expr": "rate(qbittorrent_dl_info_data_total{server=\"$server\"}[2m])", 605 | "instant": false, 606 | "interval": "", 607 | "legendFormat": "", 608 | "refId": "A" 609 | } 610 | ], 611 | "title": "Download speed", 612 | "type": "gauge" 613 | }, 614 | { 615 | "datasource": { 616 | "type": "prometheus", 617 | "uid": "${DS_PROMETHEUS}" 618 | }, 619 | "fieldConfig": { 620 | "defaults": { 621 | "decimals": 1, 622 | "mappings": [], 623 | "max": 18000000, 624 | "min": 0, 625 | "thresholds": { 626 | "mode": "absolute", 627 | "steps": [ 628 | { 629 | "color": "dark-red", 630 | "value": null 631 | }, 632 | { 633 | "color": "dark-green", 634 | "value": 4000000 635 | } 636 | ] 637 | }, 638 | "unit": "binBps" 639 | }, 640 | "overrides": [] 641 | }, 642 | "gridPos": { 643 | "h": 4, 644 | "w": 3, 645 | "x": 21, 646 | "y": 0 647 | }, 648 | "id": 17, 649 | "options": { 650 | "minVizHeight": 200, 651 | "minVizWidth": 200, 652 | "orientation": "auto", 653 | "reduceOptions": { 654 | "calcs": [ 655 | "last" 656 | ], 657 | "fields": "", 658 | "values": false 659 | }, 660 | "showThresholdLabels": false, 661 | "showThresholdMarkers": true, 662 | "sizing": "auto" 663 | }, 664 | "pluginVersion": "10.2.3", 665 | "targets": [ 666 | { 667 | "datasource": { 668 | "type": "prometheus", 669 | "uid": "${DS_PROMETHEUS}" 670 | }, 671 | "editorMode": "code", 672 | "expr": "rate(qbittorrent_up_info_data_total{server=\"$server\"}[2m])", 673 | "hide": false, 674 | "instant": false, 675 | "interval": "", 676 | "legendFormat": "", 677 | "refId": "A" 678 | } 679 | ], 680 | "title": "Upload speed", 681 | "type": "gauge" 682 | }, 683 | { 684 | "datasource": { 685 | "type": "prometheus", 686 | "uid": "${DS_PROMETHEUS}" 687 | }, 688 | "fieldConfig": { 689 | "defaults": { 690 | "color": { 691 | "mode": "palette-classic" 692 | }, 693 | "custom": { 694 | "axisBorderShow": false, 695 | "axisCenteredZero": false, 696 | "axisColorMode": "text", 697 | "axisLabel": "", 698 | "axisPlacement": "auto", 699 | "barAlignment": 0, 700 | "drawStyle": "line", 701 | "fillOpacity": 10, 702 | "gradientMode": "none", 703 | "hideFrom": { 704 | "legend": false, 705 | "tooltip": false, 706 | "viz": false 707 | }, 708 | "insertNulls": false, 709 | "lineInterpolation": "linear", 710 | "lineWidth": 1, 711 | "pointSize": 5, 712 | "scaleDistribution": { 713 | "type": "linear" 714 | }, 715 | "showPoints": "never", 716 | "spanNulls": false, 717 | "stacking": { 718 | "group": "A", 719 | "mode": "none" 720 | }, 721 | "thresholdsStyle": { 722 | "mode": "off" 723 | } 724 | }, 725 | "mappings": [], 726 | "thresholds": { 727 | "mode": "absolute", 728 | "steps": [ 729 | { 730 | "color": "green", 731 | "value": null 732 | }, 733 | { 734 | "color": "red", 735 | "value": 80 736 | } 737 | ] 738 | }, 739 | "unit": "binBps" 740 | }, 741 | "overrides": [] 742 | }, 743 | "gridPos": { 744 | "h": 10, 745 | "w": 24, 746 | "x": 0, 747 | "y": 4 748 | }, 749 | "id": 15, 750 | "options": { 751 | "legend": { 752 | "calcs": [], 753 | "displayMode": "list", 754 | "placement": "bottom", 755 | "showLegend": true 756 | }, 757 | "tooltip": { 758 | "mode": "multi", 759 | "sort": "none" 760 | } 761 | }, 762 | "pluginVersion": "10.2.3", 763 | "targets": [ 764 | { 765 | "datasource": { 766 | "type": "prometheus", 767 | "uid": "${DS_PROMETHEUS}" 768 | }, 769 | "editorMode": "code", 770 | "expr": "rate(qbittorrent_dl_info_data_total{server=\"$server\"}[2m])", 771 | "interval": "", 772 | "legendFormat": "Download $server", 773 | "range": true, 774 | "refId": "A" 775 | }, 776 | { 777 | "datasource": { 778 | "type": "prometheus", 779 | "uid": "${DS_PROMETHEUS}" 780 | }, 781 | "editorMode": "code", 782 | "expr": "rate(qbittorrent_up_info_data_total{server=\"$server\"}[2m])", 783 | "interval": "", 784 | "legendFormat": "Upload $server", 785 | "range": true, 786 | "refId": "B" 787 | } 788 | ], 789 | "title": "Transfer Rates", 790 | "type": "timeseries" 791 | }, 792 | { 793 | "datasource": { 794 | "type": "prometheus", 795 | "uid": "${DS_PROMETHEUS}" 796 | }, 797 | "fieldConfig": { 798 | "defaults": { 799 | "color": { 800 | "mode": "palette-classic" 801 | }, 802 | "custom": { 803 | "axisBorderShow": false, 804 | "axisCenteredZero": false, 805 | "axisColorMode": "text", 806 | "axisLabel": "", 807 | "axisPlacement": "auto", 808 | "barAlignment": 0, 809 | "drawStyle": "bars", 810 | "fillOpacity": 100, 811 | "gradientMode": "none", 812 | "hideFrom": { 813 | "legend": false, 814 | "tooltip": false, 815 | "viz": false 816 | }, 817 | "insertNulls": false, 818 | "lineInterpolation": "stepAfter", 819 | "lineWidth": 0, 820 | "pointSize": 5, 821 | "scaleDistribution": { 822 | "type": "linear" 823 | }, 824 | "showPoints": "never", 825 | "spanNulls": false, 826 | "stacking": { 827 | "group": "A", 828 | "mode": "normal" 829 | }, 830 | "thresholdsStyle": { 831 | "mode": "off" 832 | } 833 | }, 834 | "mappings": [], 835 | "thresholds": { 836 | "mode": "absolute", 837 | "steps": [ 838 | { 839 | "color": "green", 840 | "value": null 841 | }, 842 | { 843 | "color": "red", 844 | "value": 80 845 | } 846 | ] 847 | }, 848 | "unit": "short" 849 | }, 850 | "overrides": [] 851 | }, 852 | "gridPos": { 853 | "h": 10, 854 | "w": 14, 855 | "x": 0, 856 | "y": 14 857 | }, 858 | "id": 11, 859 | "links": [], 860 | "options": { 861 | "legend": { 862 | "calcs": [], 863 | "displayMode": "table", 864 | "placement": "right", 865 | "showLegend": true 866 | }, 867 | "tooltip": { 868 | "mode": "multi", 869 | "sort": "none" 870 | } 871 | }, 872 | "pluginVersion": "10.2.3", 873 | "targets": [ 874 | { 875 | "datasource": { 876 | "type": "prometheus", 877 | "uid": "${DS_PROMETHEUS}" 878 | }, 879 | "editorMode": "code", 880 | "expr": "sum(qbittorrent_torrents_count{category=~\"${categories}\", status!=\"complete\", server=\"$server\"}) by (status)", 881 | "interval": "", 882 | "legendFormat": "{{status}}", 883 | "range": true, 884 | "refId": "A" 885 | } 886 | ], 887 | "title": "Torrents by status", 888 | "type": "timeseries" 889 | }, 890 | { 891 | "datasource": { 892 | "type": "prometheus", 893 | "uid": "${DS_PROMETHEUS}" 894 | }, 895 | "fieldConfig": { 896 | "defaults": { 897 | "color": { 898 | "mode": "palette-classic" 899 | }, 900 | "custom": { 901 | "hideFrom": { 902 | "legend": false, 903 | "tooltip": false, 904 | "viz": false 905 | } 906 | }, 907 | "mappings": [] 908 | }, 909 | "overrides": [] 910 | }, 911 | "gridPos": { 912 | "h": 10, 913 | "w": 10, 914 | "x": 14, 915 | "y": 14 916 | }, 917 | "id": 12, 918 | "links": [], 919 | "options": { 920 | "legend": { 921 | "displayMode": "list", 922 | "placement": "bottom", 923 | "showLegend": true 924 | }, 925 | "pieType": "pie", 926 | "reduceOptions": { 927 | "calcs": [ 928 | "lastNotNull" 929 | ], 930 | "fields": "", 931 | "values": false 932 | }, 933 | "tooltip": { 934 | "mode": "single", 935 | "sort": "none" 936 | } 937 | }, 938 | "pluginVersion": "7.2.0", 939 | "targets": [ 940 | { 941 | "datasource": { 942 | "type": "prometheus", 943 | "uid": "${DS_PROMETHEUS}" 944 | }, 945 | "editorMode": "code", 946 | "expr": "sum(qbittorrent_torrents_count{category=~\"${categories}\",status!=\"complete\",server=\"$server\"}) by (category)", 947 | "interval": "", 948 | "legendFormat": "{{category}}", 949 | "range": true, 950 | "refId": "A" 951 | } 952 | ], 953 | "title": "Torrents by categories", 954 | "type": "piechart" 955 | } 956 | ], 957 | "refresh": "10s", 958 | "revision": 1, 959 | "schemaVersion": 39, 960 | "tags": [], 961 | "templating": { 962 | "list": [ 963 | { 964 | "current": { 965 | "selected": false, 966 | "text": "Prometheus", 967 | "value": "K2gjsYOMk" 968 | }, 969 | "hide": 0, 970 | "includeAll": false, 971 | "label": "Data Source", 972 | "multi": false, 973 | "name": "data_source", 974 | "options": [], 975 | "query": "prometheus", 976 | "queryValue": "", 977 | "refresh": 1, 978 | "regex": "", 979 | "skipUrlSync": false, 980 | "type": "datasource" 981 | }, 982 | { 983 | "allValue": ".*", 984 | "current": {}, 985 | "datasource": { 986 | "type": "prometheus", 987 | "uid": "${DS_PROMETHEUS}" 988 | }, 989 | "definition": "label_values(qbittorrent_up,server)", 990 | "hide": 0, 991 | "includeAll": false, 992 | "label": "Server", 993 | "multi": false, 994 | "name": "server", 995 | "options": [], 996 | "query": { 997 | "qryType": 1, 998 | "query": "label_values(qbittorrent_up,server)", 999 | "refId": "PrometheusVariableQueryEditor-VariableQuery" 1000 | }, 1001 | "refresh": 1, 1002 | "regex": "", 1003 | "skipUrlSync": false, 1004 | "sort": 0, 1005 | "tagValuesQuery": "", 1006 | "tagsQuery": "", 1007 | "type": "query", 1008 | "useTags": false 1009 | }, 1010 | { 1011 | "allValue": ".*", 1012 | "current": {}, 1013 | "datasource": { 1014 | "type": "prometheus", 1015 | "uid": "${DS_PROMETHEUS}" 1016 | }, 1017 | "definition": "label_values(qbittorrent_torrents_count{server=\"$server\"},category)", 1018 | "hide": 0, 1019 | "includeAll": true, 1020 | "label": "Categories", 1021 | "multi": true, 1022 | "name": "categories", 1023 | "options": [], 1024 | "query": { 1025 | "qryType": 1, 1026 | "query": "label_values(qbittorrent_torrents_count{server=\"$server\"},category)", 1027 | "refId": "PrometheusVariableQueryEditor-VariableQuery" 1028 | }, 1029 | "refresh": 1, 1030 | "regex": "", 1031 | "skipUrlSync": false, 1032 | "sort": 0, 1033 | "tagValuesQuery": "", 1034 | "tagsQuery": "", 1035 | "type": "query", 1036 | "useTags": false 1037 | } 1038 | ] 1039 | }, 1040 | "time": { 1041 | "from": "now-30m", 1042 | "to": "now" 1043 | }, 1044 | "timepicker": {}, 1045 | "timezone": "", 1046 | "title": "Qbittorrent", 1047 | "uid": "eKyTETFMk", 1048 | "version": 58, 1049 | "weekStart": "" 1050 | } 1051 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------