Commit 8b41384c authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Merge branch 'borg-monitor-repo-sizes' into 'master'

Monitor borg repo sizes

See merge request archlinux/infrastructure!431
parents 90a51d33 0edc4292
Pipeline #8966 passed with stage
in 57 seconds
...@@ -28,6 +28,12 @@ if [[ -f /usr/local/bin/borg ]]; then ...@@ -28,6 +28,12 @@ if [[ -f /usr/local/bin/borg ]]; then
echo "# HELP borg_hetzner_last_archive_timestamp timestamp of last backup in UTC" >> $TMP_FILE echo "# HELP borg_hetzner_last_archive_timestamp timestamp of last backup in UTC" >> $TMP_FILE
echo "# TYPE borg_hetzner_last_archive_timestamp counter" >> $TMP_FILE echo "# TYPE borg_hetzner_last_archive_timestamp counter" >> $TMP_FILE
echo "borg_hetzner_last_archive_timestamp $LAST_ARCHIVE_TIMESTAMP" >> $TMP_FILE; echo "borg_hetzner_last_archive_timestamp $LAST_ARCHIVE_TIMESTAMP" >> $TMP_FILE;
REPO_SIZE=$(/usr/local/bin/borg info --json | jq '.cache.stats.unique_csize')
echo "# HELP borg_hetzner_repo_size_bytes amount of data stored in the repo in bytes" >> $TMP_FILE
echo "# TYPE borg_hetzner_repo_size_bytes gauge" >> $TMP_FILE
echo "borg_hetzner_repo_size_bytes $REPO_SIZE" >> $TMP_FILE
fi fi
# rsync.net borg # rsync.net borg
...@@ -40,6 +46,12 @@ if [[ -f /usr/local/bin/borg-offsite ]]; then ...@@ -40,6 +46,12 @@ if [[ -f /usr/local/bin/borg-offsite ]]; then
echo "# HELP borg_offsite_last_archive_timestamp timestamp of last backup in UTC" >> $TMP_FILE echo "# HELP borg_offsite_last_archive_timestamp timestamp of last backup in UTC" >> $TMP_FILE
echo "# TYPE borg_offsite_last_archive_timestamp counter" >> $TMP_FILE echo "# TYPE borg_offsite_last_archive_timestamp counter" >> $TMP_FILE
echo "borg_offsite_last_archive_timestamp $LAST_ARCHIVE_TIMESTAMP" >> $TMP_FILE; echo "borg_offsite_last_archive_timestamp $LAST_ARCHIVE_TIMESTAMP" >> $TMP_FILE;
REPO_SIZE=$(/usr/local/bin/borg-offsite info --json | jq '.cache.stats.unique_csize')
echo "# HELP borg_offsite_repo_size_bytes amount of data stored in the repo in bytes" >> $TMP_FILE
echo "# TYPE borg_offsite_repo_size_bytes gauge" >> $TMP_FILE
echo "borg_offsite_repo_size_bytes $REPO_SIZE" >> $TMP_FILE
fi fi
mv -f $TMP_FILE $PROM_FILE mv -f $TMP_FILE $PROM_FILE
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment