Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repaired victoriametrics backup scripts #200

Open
wants to merge 2 commits into
base: labs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions packages/victoriametrics/vmbackup-cleanup-cron
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

LOG_DIR=${OMD_ROOT}/var/victoriametrics
DATA_PATH=${OMD_ROOT}/var/victoriametrics/data
CONF_DIR=$OMD_ROOT/etc/victoriametrics/conf.d

mkdir -p $LOG_DIR

(
. ${OMD_ROOT}/etc/victoriametrics/victoriametrics.conf

if [ $? != 0 ] ; then
for CFG in ${CONF_DIR}/*.conf; do
. ${CFG}
done
. etc/victoriametrics/backup.conf

if [ -z "$vm_loggerLevel" ] ; then
echo "source of config failed"
exit 8
fi
Expand Down Expand Up @@ -49,8 +54,8 @@ fi
echo ">> retention at $( date +%Y-%m-%d-%H) "

RC=0
LL=$(echo -n $SNAPSHOT_OUT | jsonpath.py '$.snapshots[*]')
for SNAPSHOT_NAME in $(echo -n $SNAPSHOT_OUT | jsonpath.py '$.snapshots[*]')

for SNAPSHOT_NAME in $(echo -n $SNAPSHOT_OUT | grep -oP '"snapshots": *\[\K[^]]+' | tr -d ' "' | tr ',' ' ')
do
echo "snapshots: ${SNAPSHOT_NAME}"
#du -ch -d1 $storageDataPath/snapshots/${SNAPSHOT_NAME}
Expand Down
10 changes: 7 additions & 3 deletions packages/victoriametrics/vmbackup-cron
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

LOG_DIR=${OMD_ROOT}/var/victoriametrics
DATA_PATH=${OMD_ROOT}/var/victoriametrics/data
CONF_DIR=$OMD_ROOT/etc/victoriametrics/conf.d

mkdir -p $LOG_DIR

(

. ${OMD_ROOT}/etc/victoriametrics/victoriametrics.conf
for CFG in ${CONF_DIR}/*.conf; do
. ${CFG}
done
. etc/victoriametrics/backup.conf

if [ $? != 0 ] ; then
if [ -z "$vm_loggerLevel" ] ; then
echo "source of config failed"
exit 8
fi
Expand Down Expand Up @@ -70,7 +74,7 @@ fi

echo $SNAPSHOT_OUT

SNAPSHOT_NAME=$(echo -n $SNAPSHOT_OUT | jsonpath.py '$.snapshot')
SNAPSHOT_NAME=$(echo -n $SNAPSHOT_OUT | grep -oP '"snapshot": *"\K[^"]+')

if [ "${SNAPSHOT_NAME}" = "" ] ; then
echo "snapshot failed"
Expand Down