summaryrefslogtreecommitdiff
path: root/prometheus_borgmatic_exporter/metrics.py
diff options
context:
space:
mode:
Diffstat (limited to 'prometheus_borgmatic_exporter/metrics.py')
-rw-r--r--prometheus_borgmatic_exporter/metrics.py124
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,
+)