From 3061eb1638cbca219a8586e73074e2cee6f69abf Mon Sep 17 00:00:00 2001 From: Joel Heaps Date: Fri, 29 Sep 2023 08:13:12 -0500 Subject: [PATCH] Match helptext to README text --- README.md | 12 ++++++------ qbittorrent_exporter/exporter.py | 25 +++++++++++++++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f1210d1..97d2a1e 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,12 @@ These are the metrics this program exports, assuming the `METRICS_PREFIX` is `qb | Metric name | Type | Description | | --------------------------------------------------- | -------- | ---------------- | -| `qbittorrent_up` | gauge | Whether if the qBittorrent server is answering requests from this exporter. A `version` label with the server version is added | -| `qbittorrent_connected` | gauge | Whether if the qBittorrent server is connected to the Bittorrent network. | -| `qbittorrent_firewalled` | gauge | Whether if the qBittorrent server is connected to the Bittorrent network but is behind a firewall. | -| `qbittorrent_dht_nodes` | gauge | Number of DHT nodes connected to | -| `qbittorrent_dl_info_data` | counter | Data downloaded since the server started, in bytes | -| `qbittorrent_up_info_data` | counter | Data uploaded since the server started, in bytes | +| `qbittorrent_up` | gauge | Whether the qBittorrent server is answering requests from this exporter. A `version` label with the server version is added. | +| `qbittorrent_connected` | gauge | Whether the qBittorrent server is connected to the Bittorrent network. | +| `qbittorrent_firewalled` | gauge | Whether the qBittorrent server is connected to the Bittorrent network but is behind a firewall. | +| `qbittorrent_dht_nodes` | gauge | Number of DHT nodes connected to. | +| `qbittorrent_dl_info_data` | counter | Data downloaded since the server started, in bytes. | +| `qbittorrent_up_info_data` | counter | Data uploaded since the server started, in bytes. | | `qbittorrent_torrents_count` | gauge | Number of torrents for each `category` and `status`. Example: `qbittorrent_torrents_count{category="movies",status="downloading"}`| ## Screenshot diff --git a/qbittorrent_exporter/exporter.py b/qbittorrent_exporter/exporter.py index 72eb233..7e0f085 100644 --- a/qbittorrent_exporter/exporter.py +++ b/qbittorrent_exporter/exporter.py @@ -89,43 +89,56 @@ class QbittorrentMetricsCollector: name=f"{self.config['metrics_prefix']}_up", value=bool(response), labels={"version": version}, - help_text="Whether server is reachable", + help_text=( + "Whether the qBittorrent server is answering requests from this" + " exporter. A `version` label with the server version is added." + ), ), Metric( name=f"{self.config['metrics_prefix']}_connected", value=response.get("connection_status", "") == "connected", labels={}, # no labels in the example - help_text="Whether server is currently connected", + help_text=( + "Whether the qBittorrent server is connected to the Bittorrent" + " network." + ), ), Metric( name=f"{self.config['metrics_prefix']}_firewalled", value=response.get("connection_status", "") == "firewalled", labels={}, # no labels in the example - help_text="Whether server is behind a firewall", + help_text=( + "Whether the qBittorrent server is connected to the Bittorrent" + " network but is behind a firewall." + ), ), Metric( name=f"{self.config['metrics_prefix']}_dht_nodes", value=response.get("dht_nodes", 0), labels={}, # no labels in the example - help_text="Number of connected DHT nodes", + help_text="Number of DHT nodes connected to.", ), Metric( name=f"{self.config['metrics_prefix']}_dl_info_data", value=response.get("dl_info_data", 0), labels={}, # no labels in the example - help_text="Data downloaded this session (bytes)", + help_text="Data downloaded since the server started, in bytes.", metric_type=MetricType.COUNTER, ), Metric( name=f"{self.config['metrics_prefix']}_up_info_data", value=response.get("up_info_data", 0), labels={}, # no labels in the example - help_text="Data uploaded this session (bytes)", + help_text="Data uploaded since the server started, in bytes.", metric_type=MetricType.COUNTER, ), ] def _get_qbittorrent_torrent_tags_metrics(self) -> list[Metric]: + """ + Returns Metric object containing number of torrents for each `category` and + `status`. + """ try: categories = self.client.torrent_categories.categories torrents = self.client.torrents.info()