View quota usage/available #967

Open
opened 2025-01-14 12:17:31 +00:00 by tarwebrood · 1 comment

What I'm trying to do and why

I want to collect statistics on my backup tasks, including quota usage & remaining quota space.

I already have "Healthchecks.io" hook configured in Borgmatic, to alert me whenever an error occurred during a backup task, or when no backup has been successfully completed for a predetermined amount of time (using the healthchecks.io service settings).

Now I also want to extract numbers from my backups, to create graphs (in Zabbix or Grafana, using the Loki hook) and to have my monitoring solution warn me before I run out of space, or whenever the backup increases in size unexpectedly.

I have seen a thread on the borgbackup issue tracker regarding viewing quota ( https://github.com/borgbackup/borg/issues/2870 ) but it is unclear to me if this information is available in Borgmatic, and if so, how to output it.

Can anyone tell me how I can get quota usage/available numbers to Loki or as JSON?

Additional link that might be useful:
Borgbackup issue #7757 Quota with a central repository server - https://github.com/borgbackup/borg/issues/7757

Steps to reproduce

No response

Actual behavior

No response

Expected behavior

No response

Other notes / implementation ideas

a huge amount of thanks for everybody contributing to this project!

borgmatic version

1.9.5

borgmatic installation method

pip install

Borg version

borg 1.4.0

Python version

Python 3.11.2

Database version (if applicable)

No response

Operating system and version

Debian GNU/Linux 12 (bookworm)

### What I'm trying to do and why I want to collect statistics on my backup tasks, including quota usage & remaining quota space. I already have "Healthchecks.io" hook configured in Borgmatic, to alert me whenever an error occurred during a backup task, or when no backup has been successfully completed for a predetermined amount of time (using the healthchecks.io service settings). Now I also want to extract numbers from my backups, to create graphs (in Zabbix or Grafana, using the Loki hook) and to have my monitoring solution warn me before I run out of space, or whenever the backup increases in size unexpectedly. I have seen a thread on the borgbackup issue tracker regarding viewing quota ( https://github.com/borgbackup/borg/issues/2870 ) but it is unclear to me if this information is available in Borgmatic, and if so, how to output it. Can anyone tell me how I can get quota usage/available numbers to Loki or as JSON? Additional link that might be useful: Borgbackup issue #7757 Quota with a central repository server - https://github.com/borgbackup/borg/issues/7757 ### Steps to reproduce _No response_ ### Actual behavior _No response_ ### Expected behavior _No response_ ### Other notes / implementation ideas a huge amount of thanks for everybody contributing to this project! ### borgmatic version 1.9.5 ### borgmatic installation method pip install ### Borg version borg 1.4.0 ### Python version Python 3.11.2 ### Database version (if applicable) _No response_ ### Operating system and version Debian GNU/Linux 12 (bookworm)
Owner

Thanks for taking the time to file this. If borgmatic were to support this, I think the first step would be get to the quota usage and limit out of Borg in a programmatic way. I see the quota usage logged upon create, but it's just a plaintext log and doesn't appear to show up in the create --json output. And I don't see it all in borg info output, which doesn't make a whole lot of sense to me given the first ticket you linked. And it's also kind of weird because I can get the plaintext quota info out of many other commands.. prune, compact, etc.

Once we have the quota usage in borgmatic, the next step would be getting it somewhere useful. For Loki, do you have a sense of a good place to put that data? For instance, I see that the existing borgmatic Loki hook has a per-logging-stream "label" mechanism. Is that an appropriate place to record the quota usage data?

If you're looking to just do this yourself, the place I've found for the quota usage data is in the output of borgmatic -v 1 create (-v 2 also works). Example:

...
Storage quota: 702.52 kB out of 1.00 GB used.
...

Related: #617

Thanks for taking the time to file this. If borgmatic were to support this, I think the first step would be get to the quota usage and limit out of Borg in a programmatic way. I see the quota usage logged upon `create`, but it's just a plaintext log and doesn't appear to show up in the `create --json` output. And I don't see it all in `borg info` output, which doesn't make a whole lot of sense to me given the first ticket you linked. And it's also kind of weird because I can get the plaintext quota info out of many other commands.. `prune`, `compact`, etc. Once we have the quota usage in borgmatic, the next step would be getting it somewhere useful. For Loki, do you have a sense of a good place to put that data? For instance, I see that the existing borgmatic Loki hook has a per-logging-stream "label" mechanism. Is that an appropriate place to record the quota usage data? If you're looking to just do this yourself, the place I've found for the quota usage data is in the output of `borgmatic -v 1 create` (`-v 2` also works). Example: ``` ... Storage quota: 702.52 kB out of 1.00 GB used. ... ``` Related: #617
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#967
No description provided.