Match helptext to README text

This commit is contained in:
Joel Heaps 2023-09-29 08:13:12 -05:00
parent e56a713355
commit 3061eb1638
2 changed files with 25 additions and 12 deletions

View File

@ -53,12 +53,12 @@ These are the metrics this program exports, assuming the `METRICS_PREFIX` is `qb
| Metric name | Type | Description | | 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_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 if the qBittorrent server is connected to the Bittorrent network. | | `qbittorrent_connected` | gauge | Whether 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_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_dht_nodes` | gauge | Number of DHT nodes connected to. |
| `qbittorrent_dl_info_data` | counter | Data downloaded since the server started, in bytes | | `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_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"}`| | `qbittorrent_torrents_count` | gauge | Number of torrents for each `category` and `status`. Example: `qbittorrent_torrents_count{category="movies",status="downloading"}`|
## Screenshot ## Screenshot

View File

@ -89,43 +89,56 @@ class QbittorrentMetricsCollector:
name=f"{self.config['metrics_prefix']}_up", name=f"{self.config['metrics_prefix']}_up",
value=bool(response), value=bool(response),
labels={"version": version}, 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( Metric(
name=f"{self.config['metrics_prefix']}_connected", name=f"{self.config['metrics_prefix']}_connected",
value=response.get("connection_status", "") == "connected", value=response.get("connection_status", "") == "connected",
labels={}, # no labels in the example 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( Metric(
name=f"{self.config['metrics_prefix']}_firewalled", name=f"{self.config['metrics_prefix']}_firewalled",
value=response.get("connection_status", "") == "firewalled", value=response.get("connection_status", "") == "firewalled",
labels={}, # no labels in the example 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( Metric(
name=f"{self.config['metrics_prefix']}_dht_nodes", name=f"{self.config['metrics_prefix']}_dht_nodes",
value=response.get("dht_nodes", 0), value=response.get("dht_nodes", 0),
labels={}, # no labels in the example labels={}, # no labels in the example
help_text="Number of connected DHT nodes", help_text="Number of DHT nodes connected to.",
), ),
Metric( Metric(
name=f"{self.config['metrics_prefix']}_dl_info_data", name=f"{self.config['metrics_prefix']}_dl_info_data",
value=response.get("dl_info_data", 0), value=response.get("dl_info_data", 0),
labels={}, # no labels in the example 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_type=MetricType.COUNTER,
), ),
Metric( Metric(
name=f"{self.config['metrics_prefix']}_up_info_data", name=f"{self.config['metrics_prefix']}_up_info_data",
value=response.get("up_info_data", 0), value=response.get("up_info_data", 0),
labels={}, # no labels in the example 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, metric_type=MetricType.COUNTER,
), ),
] ]
def _get_qbittorrent_torrent_tags_metrics(self) -> list[Metric]: def _get_qbittorrent_torrent_tags_metrics(self) -> list[Metric]:
"""
Returns Metric object containing number of torrents for each `category` and
`status`.
"""
try: try:
categories = self.client.torrent_categories.categories categories = self.client.torrent_categories.categories
torrents = self.client.torrents.info() torrents = self.client.torrents.info()