borg_export: support multiple bases
This commit is contained in:
parent
17f23cd74d
commit
b722df555d
1 changed files with 9 additions and 2 deletions
|
@ -3,13 +3,20 @@
|
|||
ENVFIILE=/etc/prometheus/node_exporter/borg_exporter.env
|
||||
[[ -f "$ENVFIILE" ]] && source "$ENVFIILE"
|
||||
|
||||
REPO_BASE=${REPO_BASE:-/home/backup/borg}
|
||||
TEXTFILE_COLLECTOR_DIR=${TEXTFILE_COLLECTOR_DIR:-/var/lib/node_exporter/}
|
||||
|
||||
PROM_FILE=$TEXTFILE_COLLECTOR_DIR/backup.prom
|
||||
TMP_FILE=$PROM_FILE.$$
|
||||
|
||||
mapfile -t REPOS < <(find "$REPO_BASE" -type d -name data -print0 | xargs --null -n1 dirname)
|
||||
if [[ -n "$REPO_BASE" ]] ; then
|
||||
REPOS+=("$REPO_BASE")
|
||||
fi
|
||||
|
||||
for repo_base in "${REPO_BASES[@]}"; do
|
||||
mapfile -t TMP < <(find "$repo_base" -type d -name data -print0 | xargs --null -n1 dirname)
|
||||
REPOS+=( "${TMP[@]}" )
|
||||
unset TMP
|
||||
done
|
||||
|
||||
if [[ -n "${REPOS[*]}" ]] ; then
|
||||
echo "# TYPE backup_age_seconds gauge"
|
||||
|
|
Loading…
Add table
Reference in a new issue