Export borgmatic backup statistics in prometheus format #1087
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1087
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'd like to do and why
I would like to monitor Borgmatic with Prometheus.
Borgmatic doesn't have a built-in Prometheus exporter, and it doesn't have a continuously running process, so in my opinion the best solutions would be to collect metrics with
Other notes / implementation ideas
The online exporters are:
I don't know for sure, but all of them will try to update the parameters on each metrics request, creating an unnecessary load.
There's also a variant of a text file exporter based on hooks: https://margau.net/posts/2024-08-02-borgmatic-prometheus/. But it's not very useful, because it doesn't know anything about the storage.
Thanks for filing this and providing some helpful leads. For context, borgmatic's existing monitoring hooks generally push information like some (or all) of the following:
None of this is by its nature time series data, but I know Prometheus is often much more oriented around metrics and time series. So could you say a little more about what (if anything) you'd expect borgmatic to push to Prometheus when borgmatic runs? Are you envisioning more like metric data, as per some of the existing exporters you linked? Or just backup success/fail status?
Hi @witten,
I think the other exporters expose all the necessary information about the backup process. The main problem with their behavior is that they have no idea about the backup process itself.
As for the metrics, I can divide them into the following groups:
Setup information
borgmatic_version- Installed version of Borgmatic.Of type info, or a gauge with version as a parameter and value of 1.
borg_version- Installed version of Borg.Of type info, or a gauge with version as a parameter and value of 1.
borg_remote_version- Installed version of Borg in the remote repository.Of type info, or a gauge with version as a parameter and value of 1.
For each remote repository.
Repository statistics
borg_archives- Number of archives in the repository.Of type gauge.
For each remote repository.
borg_unique_chunks- Number of unique chunks in the repository.Of type gauge.
For each remote repository.
borg_chunks- Number of chunks in the repository.Of type gauge.
For each remote repository.
borg_size- Original size of the backup data.Of type gauge.
For each remote repository.
borg_compressed_size- Compressed size of the backup data.Of type gauge.
For each remote repository.
borg_deduplicated_size- Deduplicated size of the backup data.Of type gauge.
For each remote repository.
borg_maximum_size- Maximum size of the repository.Of type gauge.
For each remote repository.
Last backup statistics
borg_last_backup_timestamp- Timestamp of the last backup.Of type timestamp, or a gauge. There are some problems with the type.
borg_last_backup_duration- Duration of the last backup.Of type gauge.
borg_last_backup_files- Number of files in the last backup.Of type gauge.
borg_last_backup_size- Original size of the last backup.Of type gauge.
borg_last_backup_compressed_size- Compressed size of the last backup.Of type gauge.
borg_last_backup_deduplicated_size- Deduplicated size of the last backup.Of type gauge.
I think it's possible to combine metrics into one with parameters
The timestamp parameter is problematic because
float64to parse data.Thanks, that's helpful.
To clarify: Are you referring to the "last backup statistics" here? Or are you referring to the more traditional monitoring hook information about backup success/failure? In any case, do you see that fitting in here somewhere or are you mostly just interested in the metrics?
Related: #617
In all the examples I've seen, success and failure were defined by the last backup timestamp.
Nevertheless, metrics similar to
borgmatic_last_action_successof type gauge with values0and1could be a great addition because they can trigger alerts directly.Makes sense!