summaryrefslogtreecommitdiff
path: root/prometheus_borgmatic_exporter/metrics.py
blob: 683c1798e24cb7e1101fb0e2ed707fc4cb292206 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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,
)