Fix typos and static methods
This commit is contained in:
parent
0bc9a62563
commit
2f4bab16ef
2 changed files with 7 additions and 5 deletions
|
@ -110,7 +110,7 @@ backends.
|
||||||
- `B2_ACCOUNT_ID`: (Optional) Required for Backblaze B2 backend.
|
- `B2_ACCOUNT_ID`: (Optional) Required for Backblaze B2 backend.
|
||||||
- `B2_ACCOUNT_KEY`: (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.
|
- `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.
|
Default is `60` seconds.
|
||||||
- `LISTEN_PORT`: (Optional) The address the exporter should listen on. The
|
- `LISTEN_PORT`: (Optional) The address the exporter should listen on. The
|
||||||
default is `8001`.
|
default is `8001`.
|
||||||
|
@ -151,7 +151,7 @@ services:
|
||||||
|
|
||||||
## Exported metrics
|
## Exported metrics
|
||||||
|
|
||||||
```python
|
```bash
|
||||||
# HELP restic_check_success Result of restic check operation in the repository
|
# HELP restic_check_success Result of restic check operation in the repository
|
||||||
# TYPE restic_check_success gauge
|
# TYPE restic_check_success gauge
|
||||||
restic_check_success 1.0
|
restic_check_success 1.0
|
||||||
|
|
|
@ -79,7 +79,7 @@ class ResticCollector(object):
|
||||||
)
|
)
|
||||||
scrape_duration_seconds = GaugeMetricFamily(
|
scrape_duration_seconds = GaugeMetricFamily(
|
||||||
"restic_scrape_duration_seconds",
|
"restic_scrape_duration_seconds",
|
||||||
"Ammount of time each scrape takes",
|
"Amount of time each scrape takes",
|
||||||
labels=[],
|
labels=[],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -312,11 +312,13 @@ class ResticCollector(object):
|
||||||
text_result = result.stdout.decode("utf-8")
|
text_result = result.stdout.decode("utf-8")
|
||||||
return len(text_result.split("\n")) - 1
|
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"])
|
text = snapshot["hostname"] + snapshot["username"] + ",".join(snapshot["paths"])
|
||||||
return hashlib.sha256(text.encode("utf-8")).hexdigest()
|
return hashlib.sha256(text.encode("utf-8")).hexdigest()
|
||||||
|
|
||||||
def parse_stderr(self, result):
|
@staticmethod
|
||||||
|
def parse_stderr(result):
|
||||||
return (
|
return (
|
||||||
result.stderr.decode("utf-8").replace("\n", " ")
|
result.stderr.decode("utf-8").replace("\n", " ")
|
||||||
+ " Exit code: "
|
+ " Exit code: "
|
||||||
|
|
Loading…
Reference in a new issue