diff --git a/README.md b/README.md index 586b637..f2344ef 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ backends. - `B2_ACCOUNT_ID`: (Optional) Required for Backblaze B2 backend. - `B2_ACCOUNT_KEY`: (Optional) Required for Backblaze B2 backend. - `REFRESH_INTERVAL`: (Optional) Refresh interval for the metrics in seconds. -Computing the metrics is a expensive task, keep this value as high as possible. +Computing the metrics is an expensive task, keep this value as high as possible. Default is `60` seconds. - `LISTEN_PORT`: (Optional) The address the exporter should listen on. The default is `8001`. @@ -151,7 +151,7 @@ services: ## Exported metrics -```python +```bash # HELP restic_check_success Result of restic check operation in the repository # TYPE restic_check_success gauge restic_check_success 1.0 diff --git a/restic-exporter.py b/restic-exporter.py index 8af8361..af097fa 100644 --- a/restic-exporter.py +++ b/restic-exporter.py @@ -79,7 +79,7 @@ class ResticCollector(object): ) scrape_duration_seconds = GaugeMetricFamily( "restic_scrape_duration_seconds", - "Ammount of time each scrape takes", + "Amount of time each scrape takes", labels=[], ) @@ -312,11 +312,13 @@ class ResticCollector(object): text_result = result.stdout.decode("utf-8") return len(text_result.split("\n")) - 1 - def calc_snapshot_hash(self, snapshot: dict) -> str: + @staticmethod + def calc_snapshot_hash(snapshot: dict) -> str: text = snapshot["hostname"] + snapshot["username"] + ",".join(snapshot["paths"]) return hashlib.sha256(text.encode("utf-8")).hexdigest() - def parse_stderr(self, result): + @staticmethod + def parse_stderr(result): return ( result.stderr.decode("utf-8").replace("\n", " ") + " Exit code: "