Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
backupninja
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Liberate
backupninja
Commits
1d7e00fa
Commit
1d7e00fa
authored
2 months ago
by
Guillaume Subiron
Browse files
Options
Downloads
Patches
Plain Diff
borg: allow to export borg list and borg info for monitoring
parent
0bce7106
No related branches found
No related tags found
1 merge request
!69
Multiple improvements in borg handler
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/example.borg
+16
-0
16 additions, 0 deletions
examples/example.borg
handlers/borg.in
+45
-2
45 additions, 2 deletions
handlers/borg.in
with
61 additions
and
2 deletions
examples/example.borg
+
16
−
0
View file @
1d7e00fa
...
...
@@ -46,6 +46,22 @@
## Default:
# bwlimit = 0
## export "borg info last_archive" to a given file
## this is usefull for monitoring without using borg
##
## Example:
# borginfo = /var/backups/borginfo.json
## Default:
# borginfo =
## export "borg list repository" to a given file
## this is usefull for monitoring without using borg
##
## Example
# borglist = /var/backups/borglist.json
## Default:
# borglist =
######################################################
## source section
## (where the files to be backed up are coming from)
...
...
This diff is collapsed.
Click to expand it.
handlers/borg.in
+
45
−
2
View file @
1d7e00fa
...
...
@@ -31,6 +31,9 @@ getconf nicelevel 0
getconf ionicelevel
getconf bwlimit
getconf borginfo
getconf borglist
setsection
source
getconf init
yes
getconf include
...
...
@@ -250,8 +253,48 @@ if [ "$prune" == "yes" ]; then
warning
"
$output
"
warning
"Removing old backups finished with warnings."
else
error
$output
fatal
"Failed removing old backups."
info
"
$output
"
warning
"Failed removing old backups. Borg returned exit code
${
ret
}
."
fi
fi
fi
### WRITE STATS FILES ###
if
[
-n
"
$borginfo
"
]
;
then
mkdir
-p
"
$(
dirname
"
$borginfo
"
)
"
infostr
=
"borg info
$execstr_repository
--last 1 --json >
$borginfo
"
debug
"
$infostr
"
if
[
"
$test
"
=
0
]
;
then
output
=
$(
su
-c
"
$infostr
"
2>&1
)
ret
=
$?
if
[
$ret
=
0
]
;
then
debug
"
$output
"
info
"Successfully writing borg info to
$borginfo
"
else
info
"
$output
"
error
"Failed to write borg info to
$borginfo
"
fi
fi
fi
if
[
-n
"
$borglist
"
]
;
then
mkdir
-p
"
$(
dirname
"
$borglist
"
)
"
infostr
=
"borg list
$execstr_repository
--json >
$borglist
"
debug
"
$infostr
"
if
[
"
$test
"
=
0
]
;
then
output
=
$(
su
-c
"
$infostr
"
2>&1
)
ret
=
$?
if
[
$ret
=
0
]
;
then
debug
"
$output
"
info
"Successfully writing borg list to
$borglist
"
else
info
"
$output
"
error
"Failed to write borg list to
$borglist
"
fi
fi
fi
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment