cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1201
Views
7
Helpful
4
Replies

Scheduling / automating APIC-EM backups

javerill
Level 1
Level 1

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

4 Replies 4

ymeloch
Cisco Employee
Cisco Employee

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

Thanks!

The CLI process works perfectly!

ngoldwat
Level 4
Level 4

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

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

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:


This community is intended for developer topics around Data Center technology and products. If you are looking for a non-developer topic about Data Center, you might find additional information in the Data Center and Cloud community