Give access to results details in case of succeeded archive creation #385
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#385
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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'm trying to do and why
I am monitoring borgmatics logs using icinga and a python script (small log parser).
In order to be reliable, I made use of borgmatic hooks.
I would like to get extra infos, like e.g. duration of the archive creation. It would be nice to get all ouput or the creation sumary in hooks variables.
Currently, only
on_error
hooks is getting extra infos (output, error).Other notes / implementation ideas
I suggest making available:
It would be great if summary is parsed into variables:
Thank you for filing this. The output and summary are currently sent to the logging system (
syslog
orjournalctl
). Is the problem that it's just not convenient or reliable to parse them from there?As for the duration of archive creation and similar data, have you considered running borgmatic with the
--json
flag? That of course won't make the data available to hooks, but it does return easily parseable info like archive duration.Let me know your thoughts!
I'm using a small script which parses journalctl as per my needs after borgmatic completed the backup. It mainly filters on keywords like "Successful" plus a list of desired log level data like "WARNING" or "ERROR".
I'm running the script as "ExecStopPost" in the systemd service, but you can also start it via the "after_backup" hook from Borgmatic itself.
Another method I used previously was to write the log in parallel to a temporary file (with separate log level), but then I still wanted some post processing/filter so that I now simply use the journalctl.
Well, I see. Actually I didn't throught about calling borgmatic with the
--json
flag. It gives the expected result.E.g. I can get many info using:
And if I am only interested in durations I can get those with:
Currently it appears that it is ok to call
borgmatic --info
orborgmatic --list
into a hook. Do you advise against it ?I apologize for the super lengthy delay in getting back to this. I generally don't recommend calling borgmatic from borgmatic (especially because of the infinite loop risk), but in this case I don't see a better option given the current feature set.
Assuming this is still a relevant issue to you, how can/does your monitoring software consume information from the software it's monitoring? For instance, if borgmatic had a built-in feature to write some of the stats you're looking for to a JSON file (as in #617), would that be easier to monitor?
I'm closing this one for now due to inactivity, but I'd be happy to open it up again if you have further thoughts. Thank you!