09-20-2017 07:20 AM - edited 03-01-2019 04:40 AM
Is there an "easy" way to automate backups of an APIC-EM server?
Currently running a single instance VM of APIC-EM version 1.5.0.1368.
Thanks in advance!
-Jason
09-20-2017 08:22 AM
That can be done using the API or CLI.
API (RESTful):
POST: https://[controller_ip]/grapevine/api/backup
CLI:
[root@template-RH58Cluster ~]# ssh grapevine@1[controller_ip]
grapevine@10.122.6.150's password:
Welcome to the Cisco APIC-EM Appliance - Powered by Grapevine
System information as of Mon Jul 10 17:02:17 UTC 2017
System load: 2.31 Processes: 517
Usage of /: 11.9% of 460.29GB Users logged in: 1
Memory usage: 84% IP address for eth0: 10.122.6.150
Swap usage: 0% IP address for grape-br0: 169.254.0.1
APIC-EM Version: 1.4.3.1009
Grapevine Version: 1.4.3.4006.dev1051-g4b268d4
Last login: Mon Jul 10 16:56:35 2017 from wwsp-il-dhcp-076.cisco.com
(grapevine)
[Mon Jul 10 17:02:18 UTC] grapevine@10.122.6.150 (grapevine-root-1) ~
$ grape backup grow
task_id: 96e80a6e-6591-11e7-b1c4-005056a90aa1
Tip:
Use 'grape task display <task_id>' to monitor progress of task
09-20-2017 08:31 AM
Thanks!
The CLI process works perfectly!
09-20-2017 09:53 AM
A little more information. The grape backup grow writes the file to (in my case) /mnt/gfs_block/backups/689835e2-9e1e-11e7-ae20-005056846dbd/backup_2017-09-20_12-09-37.backup
You could create a crontab job that will both create the backup and store it off the server somewhere.
Here is an example bash script you could automate.
Note: This is an untested script and I've noticed an issue with the delete function actually deleting the file but not the pointer to it in grape backup display.
#!/bin/sh
#
if [ `whoami` != grapevine ]; then
exit 3
fi
#
grape backup grow
sleep 20
/usr/bin/updatedb
FILENAME=`grape backup display | grep filename | awk '{print $3}' | tail -n 1`
LOCATION=`/usr/bin/locate $FILENAME`
rsync -av $LOCATION admin@yourIP
grape backup delete $FILENAME
exit 0
10-11-2017 05:51 AM
Here is a script that will work when initiated by crontab:
#!/bin/sh
# Set variables
FTPHOST='10.255.0.100'
FTPUSER='anonymous'
FTPPASSWD='network'
FTPDIR='APIC-EM/Backups/usspvlapic01'
FILE='*.backup'
# Create Backup
/opt/cisco/grapevine/bin/grape backup grow
# Wait 10 minutes for backup to complete
sleep 10m
# Change to backup repository
cd /srv/grapevine/replicated-storage/backups/*005056b40bcd/
# FTP backup file to external FTP server
ftp -in $FTPHOST <<END_SCRIPT
quote USER $FTPUSER
quote PASS $FTPPASSWD
bin
cd $FTPDIR
mput $FILE
quit
END_SCRIPT
exit 0
All that needs to be customized are the variables and the directory on the APIC-EM server where the backups are stored.
-Jason
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide