diff options
| author | Dennis Fink | 2026-05-06 19:51:45 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-05-06 19:51:45 +0200 |
| commit | 5a2d4ca818e6ee45f99e4c92310e137a7b1b4aea (patch) | |
| tree | 9f1338915f0755c71f5c65573019939dbef0c24a /prometheus_borgmatic_exporter/metrics.py | |
| parent | d9e410a10b2c175fc32437b35c59eccf5172b051 (diff) | |
| download | prometheus-borgmatic-exporter-5a2d4ca818e6ee45f99e4c92310e137a7b1b4aea.tar.gz prometheus-borgmatic-exporter-5a2d4ca818e6ee45f99e4c92310e137a7b1b4aea.zip | |
feat: implement initial borgmatic Prometheus exporterv1.0.0
Diffstat (limited to '')
| -rw-r--r-- | prometheus_borgmatic_exporter/metrics.py | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/prometheus_borgmatic_exporter/metrics.py b/prometheus_borgmatic_exporter/metrics.py new file mode 100644 index 0000000..683c179 --- /dev/null +++ b/prometheus_borgmatic_exporter/metrics.py @@ -0,0 +1,124 @@ +"""Prometheus metric definitions for the borgmatic exporter.""" + +# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> +# +# SPDX-License-Identifier: BSD-3-Clause + +from prometheus_client import CollectorRegistry, Gauge, Info + +REGISTRY = CollectorRegistry(auto_describe=True) + +TOTAL_CHUNKS = Gauge( + "borg_total_chunks", + "Total chunks", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +TOTAL_COMPRESSED_SIZE = Gauge( + "borg_total_compressed_size_bytes", + "Total compressed size", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +TOTAL_ORIGINAL_SIZE = Gauge( + "borg_total_original_size_bytes", + "Total original size", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +TOTAL_UNIQUE_CHUNKS = Gauge( + "borg_total_unique_chunks", + "Total unique chunks", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +TOTAL_DEDUPLICATED_COMPRESSED_SIZE = Gauge( + "borg_total_deduplicated_compressed_size_bytes", + "Unique compressed size", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +TOTAL_DEDUPLICATED_SIZE = Gauge( + "borg_total_deduplicated_size_bytes", + "Unique size", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +LAST_MODIFIED = Gauge( + "borg_last_modified_timestamp_seconds", + "Last modified timestamp", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +ARCHIVES = Gauge( + "borg_archives", + "Amount of archives", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +LATEST_ARCHIVE_COMPRESSED_SIZE = Gauge( + "borg_latest_archive_compressed_size_bytes", + "Compressed size of archive", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +LATEST_ARCHIVE_DEDUPLICATED_SIZE = Gauge( + "borg_latest_archive_deduplicated_size_bytes", + "Deduplicated size of archive", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +LATEST_ARCHIVE_NUMBER_FILES = Gauge( + "borg_latest_archive_files_total", + "Number of files in archive", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +LATEST_ARCHIVE_ORIGINAL_SIZE = Gauge( + "borg_latest_archive_original_size_bytes", + "Original size of archive", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +LATEST_ARCHIVE_DURATION = Gauge( + "borg_latest_archive_duration_seconds", + "Duration of archive", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) +ARCHIVE_COMPRESSED_SIZE = Gauge( + "borg_archive_compressed_size_bytes", + "Compressed size of archive", + ["repository_id", "repository_label", "location", "archive_id", "archive_name"], + registry=REGISTRY, +) +ARCHIVE_DEDUPLICATED_SIZE = Gauge( + "borg_archive_deduplicated_size_bytes", + "Deduplicated size of archive", + ["repository_id", "repository_label", "location", "archive_id", "archive_name"], + registry=REGISTRY, +) +ARCHIVE_NUMBER_FILES = Gauge( + "borg_archive_files_total", + "Number of files in archive", + ["repository_id", "repository_label", "location", "archive_id", "archive_name"], + registry=REGISTRY, +) +ARCHIVE_ORIGINAL_SIZE = Gauge( + "borg_archive_original_size_bytes", + "Original size of archive", + ["repository_id", "repository_label", "location", "archive_id", "archive_name"], + registry=REGISTRY, +) +ARCHIVE_DURATION = Gauge( + "borg_archive_duration_seconds", + "Duration of archive", + ["repository_id", "repository_label", "location", "archive_id", "archive_name"], + registry=REGISTRY, +) +ENCRYPTION = Info( + "borg_repository_encryption", + "Encryption information about the repository", + ["repository_id", "repository_label", "location"], + registry=REGISTRY, +) |
