mirror of
https://github.com/bashclub/miyagi-pbs-zfs.git
synced 2025-12-06 06:28:43 +00:00
Update pbs-zfs-daily.sh
Now with Bashclub ZSYNC
This commit is contained in:
@@ -3,18 +3,21 @@
|
|||||||
#Requirements for Myiagi ultimate Backup
|
#Requirements for Myiagi ultimate Backup
|
||||||
## Proxmox Source Host with only daily Autosnapshots, Proxmox Destination Host, Destination Public SSH Key on Source authorized-keys File, autostarting Proxmox Backupserver running on this PVE, zfs set com.sun:auto-snapshots=false on $ZFSTRGT, instaled checkzfs from https://github.com/bashclub/check-zfs-replication, check_mk Agent running on PVE
|
## Proxmox Source Host with only daily Autosnapshots, Proxmox Destination Host, Destination Public SSH Key on Source authorized-keys File, autostarting Proxmox Backupserver running on this PVE, zfs set com.sun:auto-snapshots=false on $ZFSTRGT, instaled checkzfs from https://github.com/bashclub/check-zfs-replication, check_mk Agent running on PVE
|
||||||
|
|
||||||
SOURCEHOST='192.168.0.241' # IP from Proxmox VE System to be backuped and replicated daily
|
SOURCEHOST='192.168.1.20' # IP from Proxmox VE System to be backuped and replicated daily
|
||||||
SOURCEHOSTNAME='pve' #Hostname of Proxmox VE System to be backuped and replicated daily
|
SOURCEHOSTNAME='pve20' #Hostname of Proxmox VE System to be backuped and replicated daily
|
||||||
ZFSKEEP='10' # How many Snapshots to be kept, suggested 10 Days
|
|
||||||
|
|
||||||
ZFSROOT='rpool/data' #First Dataset/Datastoresourcepath from Proxmox VE System to be backuped and replicated daily
|
ZFSROOT='rpool/data' #First Dataset/Datastoresourcepath from Proxmox VE System to be backuped and replicated daily
|
||||||
ZFSTRGT='rpool/repl' #This pulling Machines Target ZFS Sourcepath
|
ZFSTRGT='rpool/repl' #This pulling Machines Target ZFS Sourcepath
|
||||||
ZPOOLSRC=rpool #First Pool/Tank from Proxmox VE System to be backuped and replicated daily
|
ZPOOLSRC=rpool #First Pool/Tank from Proxmox VE System to be backuped and replicated daily
|
||||||
ZPOOLDST=rpool #This pulling Machines Pool/Tank
|
ZPOOLDST=rpool #This pulling Machines Pool/Tank
|
||||||
|
ZPUSHTAG=bashclub:zsync
|
||||||
|
ZPUSHMINKEEP=3
|
||||||
|
ZPUSHKEEP=14
|
||||||
|
ZPUSHLABEL=zsync-30
|
||||||
|
ZPUSHFILTER="\"monthly|daily\"" #zpushlabel kommt automatisch mit
|
||||||
|
|
||||||
|
PBSHOST='192.168.1.16' #IP from your Proxmox Backupserver
|
||||||
PBSHOST='192.168.0.171' #IP from your Proxmox Backupserver
|
BACKUPSTORE=backup #Datastorename configured in your Proxmox VE System to be backuped and replicated daily
|
||||||
BACKUPSTORE=backup241 #Datastorename configured in your Proxmox VE System to be backuped and replicated daily
|
|
||||||
BACKUPSTOREPBS=backup #Datastorename configured in your Proxmox Backup Server
|
BACKUPSTOREPBS=backup #Datastorename configured in your Proxmox Backup Server
|
||||||
BACKUPEXCLUDE='999' #Machines to be excluded from Proxmox Backup
|
BACKUPEXCLUDE='999' #Machines to be excluded from Proxmox Backup
|
||||||
PRUNEJOB=$(ssh $PBSHOST proxmox-backup-manager prune-job list --output-format json-pretty | grep -m 1 "id" | cut -d'"' -f4)
|
PRUNEJOB=$(ssh $PBSHOST proxmox-backup-manager prune-job list --output-format json-pretty | grep -m 1 "id" | cut -d'"' -f4)
|
||||||
@@ -24,15 +27,19 @@ SCRIPTPATH=/usr/bin #Location of bashclub-zfs Tool - https://raw.githubuserconte
|
|||||||
|
|
||||||
MAINTDAY=0
|
MAINTDAY=0
|
||||||
|
|
||||||
SOURCEALL=$(ssh -p$SSHPORT root@$SOURCEHOST 'for src in $(zfs list -H -o name |grep '"$ZFSROOT"'/|grep -v alt|grep -v state|grep -v disk-9); do echo ${src##*/}; done') #determines Source Datasets without 'alt, state and disk-9' in Name - Those are typlically not replicated
|
# ssh root@$SOURCEHOST zfs set $ZPUSHTAG=subvols $ZFSROOT
|
||||||
echo ''
|
# Schleife für Excludes
|
||||||
echo Pulling Replicas from $SOURCEHOST following Datasets/ZVOLS $SOURCEALL
|
echo "target=rpool/repl" > /etc/bashclub/$SOURCEHOST.conf
|
||||||
echo ''
|
echo "source=root@$SOURCEHOST" >> /etc/bashclub/$SOURCEHOST.conf
|
||||||
for DATA in $SOURCEALL
|
echo "sshport=$SSHPORT" >> /etc/bashclub/$SOURCEHOST.conf
|
||||||
do
|
echo "tag=$ZPUSHTAG" >> /etc/bashclub/$SOURCEHOST.conf
|
||||||
$SCRIPTPATH/bashclub-zfs -p $SSHPORT -k $ZFSKEEP -v $SOURCEHOST:$ZFSROOT/$DATA $ZFSTRGT #for debugging add an echo at the Beginning of this line
|
echo "snapshot_filter=$ZPUSHFILTER" >> /etc/bashclub/$SOURCEHOST.conf
|
||||||
done
|
echo "min_keep=$ZPUSHMINKEEP" >> /etc/bashclub/$SOURCEHOST.conf
|
||||||
###
|
echo "zfs_auto_snapshot_keep=$ZPUSHKEEP" >> /etc/bashclub/$SOURCEHOST.conf
|
||||||
|
echo "zfs_auto_snapshot_label=$ZPUSHLABEL" >> /etc/bashclub/$SOURCEHOST.conf
|
||||||
|
|
||||||
|
|
||||||
|
/usr/bin/bashclub-zsync -d -c /etc/bashclub/$SOURCEHOST.conf
|
||||||
|
|
||||||
# So one Day has 1440 Minutes, so we go condition Yellow on 1500
|
# So one Day has 1440 Minutes, so we go condition Yellow on 1500
|
||||||
/usr/local/bin/checkzfs --source $SOURCEHOST --replicafilter $ZFSTRGT/ --filter $ZFSROOT/ --threshold 1500,2000 --output checkmk --prefix pullrepl > /tmp/cmk_tmp.out && ( echo "<<<local>>>" ; cat /tmp/cmk_tmp.out ) > /tmp/90000_checkzfs
|
/usr/local/bin/checkzfs --source $SOURCEHOST --replicafilter $ZFSTRGT/ --filter $ZFSROOT/ --threshold 1500,2000 --output checkmk --prefix pullrepl > /tmp/cmk_tmp.out && ( echo "<<<local>>>" ; cat /tmp/cmk_tmp.out ) > /tmp/90000_checkzfs
|
||||||
|
|||||||
Reference in New Issue
Block a user