Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Tarsnap helpers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Andreas Olsson
Tarsnap helpers
Commits
0cfbe0bd
Commit
0cfbe0bd
authored
12 years ago
by
Andreas Olsson
Browse files
Options
Downloads
Patches
Plain Diff
Adding Munin plugin.
parent
115a0d14
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
COPYING
+1
-1
1 addition, 1 deletion
COPYING
README
+6
-0
6 additions, 0 deletions
README
tarsnap_usage
+74
-0
74 additions, 0 deletions
tarsnap_usage
with
81 additions
and
1 deletion
COPYING
+
1
−
1
View file @
0cfbe0bd
Copyright (c) 2009
,
201
0, 2011
Andreas Olsson
Copyright (c) 2009
-
201
2
Andreas Olsson
Permission is hereby granted, free of charge, to any person
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
obtaining a copy of this software and associated documentation
...
...
This diff is collapsed.
Click to expand it.
README
+
6
−
0
View file @
0cfbe0bd
...
@@ -10,3 +10,9 @@ Nagios plugin which works by reading a text file containing a Unix
...
@@ -10,3 +10,9 @@ Nagios plugin which works by reading a text file containing a Unix
timestamp of the most recent tarsnap backup. See the top comment in
timestamp of the most recent tarsnap backup. See the top comment in
check_tarsnap for an example on how your tarsnap backup script can
check_tarsnap for an example on how your tarsnap backup script can
generate such a file.
generate such a file.
* tarsnap_usage
This Munin plugin keeps track on how much data a machine has backed up
on tarsnap. This is done by reading the current amount of data from a
text file, preferably updated by the tarsnap backup script. See the
plugin documentation for details.
This diff is collapsed.
Click to expand it.
tarsnap_usage
0 → 100755
+
74
−
0
View file @
0cfbe0bd
#!/bin/sh
# -*- sh -*-
: <<
'=cut'
=
head1 NAME
tarsnap_usage - Plugin to measure amount of tarsnap stored data
=
head1 CONFIGURATION
By default the amount of data will be
read
from the file
/var/lib/tarsnap/status/data. Another file can be specified by setting
the variable datafile.
[
tarsnap_usage]
env.datafile /path/to/datafile
=
head2 DATA FILE
The plugin expects the data file to contain a numeric value, and
nothing more, representing the number of bytes stored. One way to have
that file generated is by running something like the following at the
end of your tarsnap backup script.
data
=
$(
tarsnap
--print-stats
|
sed
-nre
"s/^
\s
+
\(
unique data
\)\s
+[0-9]+
\s
+([0-9]+)
$/
\1
/p"
)
[
-n
"
$data
] && echo "
$data
" > /var/lib/tarsnap/status/data
=head1 AUTHOR
Andreas Olsson <andreas@arrakis.se>
=head1 LICENSE
MIT License
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
if [ -z "
$datafile
" ]; then
datafile="
/var/lib/tarsnap/status/data
"
fi
amount=
$(
cat
"
$datafile
"
2> /dev/null
)
is_numeric () {
echo "
$amount
" | grep -Eq "
^[0-9]+
$" && return 0 || return 1
}
if [ "
$1
" = "
autoconf
" ]; then
is_numeric && echo yes || echo no
exit 0
fi
if [ "
$1
" = "
config
" ]; then
echo 'graph_title Tarsnap usage'
echo 'graph_vlabel byte stored'
echo 'data.label total usage'
echo 'graph_args --base 1000 -l 0'
echo 'graph_category disk'
echo 'graph_info Total amount of unique data backed up by tarsnap. That is, after deduplication and compression.'
exit 0
fi
if ! is_numeric; then
echo "
Failed to
read
expected data from
${
datafile
}
"
exit 1
fi
echo "
data.value
${
amount
}
"
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