Add option to show last successful backup #86
Loading…
x
Reference in New Issue
Block a user
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?
from https://github.com/borgbackup/borg/issues/4047:
I need to integrate a check for successful backups in our monitoring system.
If would be nice if borgmatic could have a command like
borgmatic --last-success
containing the details (time, archive name) of the last successful backup (excluding checkpoint archives).I agree with the borg maintainer:
it seems like this is rather something for a on-top-of-borg management tool.
, which is why I'm asking here for implementation.Will this do it?
Or, if you want to get that in JSON form, and are using using a recent version of jq:
Here's an snippet from a bash script I use for monitoring the age of the last archive with borg:
@witten, $thomasleveil: Using
--last 1
will eventually show a checkpoint archive, which I not consider a successful archive.I now use this to show the last successful backup timestamp in the repo:
Well, I convinced myself it's possible to get the timestamp of the most recent non-checkpoint archive with jq:
But that's not very ergonomic, so I could see the utility in having a feature like this more baked into borgmatic.
@witten: Nice! I agree this would be good to integrate into borgmatic.
Mentioned another implementation idea for this ticket in comments on #97. Basically, the "gimme the last successful backup" feature could be in a separate piped command that specializes in dealing with and parsing Borg JSON output. Example:
Hello,
one point that I see as a problem with relying on borg list is, that the backup target may be offline. Thus, I suggest to cache this information. I.e. borgmatic --list would just print the output of the borg list command that is run after each borgmatic run.
Greetings,
Hendrik
Just released borgmatic 1.3.24 with a new
borgmatic list --successful
flag to hopefully satisfy this ask. It simply excludes Borg checkpoint archives from the list. So if you want just the last one, you can do something like this:And then of course you can use
--json
if you'd like to parse out additional information about a particular archive (like the time).Let me know how this works for you!
@witten: Awesome !!
This shows the time the last successful backup was made:
Cool! Docs are here: https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/#successful-backups
witten/borgmatic#224
😞