Forum Discussion
Automatic backup of BIGIP LTM
Can Anybody suggest me how to take automatic backup in BIG IP LTM v11.2? I want to take weekly backup of system configuration automatically .
Pls help on this .
- oshaughnessy_19Nimbostratus
I wrote a script to run "tmsh save /sys ucs" on each of a set of LTMs, download the resulting archive, then expand it and store the changes in git. Here's a copy of it, cleaned up for distribution a little bit.
!/bin/sh f5-backup: create UCS backups of a list of BIG-IP F5 devices (most likely Local Traffic Managers, aka LTMs) See https://support.f5.com/kb/en-us/solutions/public/13000/100/sol13132.html Author: O'Shaughnessy Evans, 2015-09 trap sigdie INT QUIT umask 022 safety checks: exit on unset variables and errors, don't expand * set -o nounset set -o errexit set -o noglob ME=${0*/} HOSTS=${*:-"FIX: put your default hosts here"} BACKUP_DIR=$HOME/var/f5 BACKUP_USER=rancid REMOTE_TMPDIR=/var/tmp sigdie() - Signal handler that reports the cause of death (barely) function sigdie { die $EX_OSERR "killed" } Make sure we're running as the intended backup user. This ensures that ssh always runs under the same conditions and that directories relative to $HOME are always the same. if [[ "$USER" != "$BACKUP_USER" ]]; then echo "fatal error: running as $USER; please invoke as $BACKUP_USER" >&2 exit 2 fi remote_backup=$REMOTE_TMPDIR/backup-$(date +%F).ucs for host in $HOSTS; do local_backup=$host-$(date +%F).tar.gz cd $BACKUP_DIR [[ -d $host ]] || mkdir $host cd $host echo " Creating UCS backup for $host" echo "" echo " tmsh save /sys ucs ..." ssh $host tmsh save /sys ucs $remote_backup 2>&1 |sed 's,^, tmsh save: ,' echo "" echo "* Downloading" echo "" echo " $remote_backup -> $local_backup" scp -o 'StrictHostKeyChecking no' -q $host:$remote_backup $local_backup 2>&1 |sed 's,^, scp: ,' gunzip -c $local_backup |tar xf - rm $local_backup echo "" echo "* Saving change in Git" echo "" git add . |sed 's,^, git-add: ,' git commit -m"$ME: automated backup of $host at $(date)" |sed 's,^, git-commit: ,' git push 2>&1 |sed 's,^, git-push: ,' echo "" done
You'll want to change a few things:
- Where you see "FIX: put your default hosts here", replace it with a space-separated list of the hostnames you're backing up. Alternatively, you can pass the list of hostnames on the command line when you run the script.
- Assign the username of the user ID you're running the backup script as to
.BACKUP_USER
- Assign the directory where you want to maintain your git repo to
.BACKUP_DIR
I wrote it assuming that
has a shell account on the F5 that can be accessed with its ssh key. If you don't have one, create an account with "advanced shell" permissions and "Resource Administrator" rights, then generate an ssh key for it on the host where this script will run (e.g.$BACKUP_USER
), then copy the public key tossh-keygen -t rsa -b 2048
on each of the F5s you want to back up. You'll also need to enable the user of an authorized keys file if you haven't done so. See SOL13454: Configuring SSH host-based authentication on BIG-IP systems (11.x) for more details.~/.ssh/authorized_keys
You'll want to initialize
as a git repository, too. The script will git-add, commit, and push any changes between runs, so if you set a remote repository as your origin, you'll get a changelog on your Git server. It's very convenient.$BACKUP_DIR
To recover with the contents of this repository, you would need to check out the repo, remove the .git subdir, then tar it up and gzip it. The result should be the same as the last
that was run on that server. I should add that I haven't tested a restore from this, though, and that should be a real big caveat here. So... buyer beware :^)tmsh save /sys ucs
- F5_Irfan_160609NimbostratusSalam, Mahmoud Eldeed, Can you please share username password of VM appliance, as i have downloaded & wanted to access (irfaan.cisco@gmail.com)
- MichealRP_61305Nimbostratus
I realize that this is an older question, but also realize that there are those that prefer to do things a bit old school.
Things to remember:
- BigIP appliances run Linux.
- As a Linux base OS, it does support NFS mounts and crontab.
- Create a mount point on your backup storage system, then you can mount the partition on the BigIP device to make it available.
- Create a contab job to backup the ucs and scf files to the NFS mount created.
- In my case, this makes managing things quite simple as I can run scripts against the scf files and search for nodes that are being decommissioned without having to search via the gui.
While it may be looked down on by some, keep in mind that *Nix devices have been doing this for many years with tar and nfs mounts.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com