on 25-Sep-2012 15:06
I wrote an article last year on utilizing iApps to put a front-end on a common system task, BIG-IP configuration archiving. This worked well for that initial v11 release, but something changed along the way that prevented some of the magic from happening. I think there are two things at play here on later versions:
I recommend utilizing the /shared mount for this process. It’s not read-only like the /usr file system, and it mounts in every boot slot, which is ideal for carrying forward through upgrades.
Login into your BIG-IP and create the necessary directories
[root@dctest-01:Active:Standalone] # cd /shared
[root@dctest-01:Active:Standalone] shared # mkdir backups
[root@dctest-01:Active:Standalone] shared # mkdir backups/bin
[root@dctest-01:Active:Standalone] shared # mkdir backups/archives
First, upload the shell script (f5backup.sh from the attachement available on the iApp codeshare page)via scp from your desktop to the /shared/backups/bin directory you created on your BIG-IP. Next, login to the BIG-IP GUI and then click on iApp and Templates
Click Import and upload the bigip_archiving_iApp.tcl file from the attachment linked above.
The f5.archiving iApp should now be in the Templates listing:
Click on Application Services and click Create. Select the f5.archiving template and you’ll see the Backup Schedule options. Choose Daily, Weekly, or Monthly settings as appropriate. For the purposes of this article, I’ll select the Daily and a time of 14:45.
This will create the file in /etc/cron.d, as verified in the cli output below:
[root@dctest-01:Active:Standalone] archives # ls -las /etc/cron.d
total 12
2 drwx------ 2 root root 1024 Sep 25 14:07 .
6 drwxr-xr-x 59 root root 5120 Sep 25 12:14 ..
2 -rw-r--r-- 1 root root 177 Sep 25 14:42 f5backups
2 -rw-r--r-- 1 root root 87 Aug 29 15:52 sysstat
Now we’ll verify the contents of the f5backups script created by the iApp:
[root@dctest-01:Active:Standalone] archives # cat /etc/cron.d/f5backups
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
#MAILTO=user@somewhere
HOME=/var/tmp/
45 14 * * * root /bin/bash /shared/backups/bin/f5backup.sh 1>/var/tmp/f5backup.log 2>&1
All the work is done, now all that’s left is to verify the backup actually occurred:
[root@dctest-01:Active:Standalone] archives # ls -las /shared/backups/archives
total 50736
8 drwx------ 2 root root 4096 Sep 25 14:45 .
8 drwx------ 4 root root 4096 Sep 25 12:58 ..
12680 -rw------- 1 root root 12956815 Sep 25 13:10 f5backup-dc2-dev-egw-01.dc.local-20120925130958.tar.bz2
12680 -rw-r--r-- 1 root root 12956947 Sep 25 14:45 f5backup-dc2-dev-egw-01.dc.local-20120925144501.tar.bz2
The full URL for the codeshare sample added today: https://devcentral.f5.com/s/wiki/iApp.Configuration_Backup_Scheduler_v11_2.ashx
i deployed the iApp and it works. However, if i have a redundant pair, only the one where i configured the iApp does the backup. After a failover, the second box doesn't backup as the cronjob is missing on it. If i reconfigure the iApp it works again. As well would it be nice if both boxes backup their configuration when the iApp is deployed. Is there a way to achieve this with an iApp?
This all comes down to this iApp configuring items that are effectively “base” configuration items (in this case, cron tabs that aren’t even managed by the primary control plane) and not shared configuration items. In order to make this work for all devices in the sync group, you would have to run the iApp on each member to configure the respective “base” configuration items for each.
Please confirm the below in regards of backup.
1) Can we do backup scheduling in a remote server instead of local or both.
2) How can i send the Email Notification whether the backup is successful or not?
By the way, it is a nice article and currently i am deploying it.
Regards,
Mubasher Sultan
1) Can we do backup scheduling in a remote server instead of local or both.
-- yes, you can modify the script to send to remote server, but you'll need to generate ssh keys and get that setup done, which is outside the scope of this article. Stay tuned for some movement on this front when 11.4 launches, I just might have what you're looking for, in much better packaging than the current version.
2) How can i send the Email Notification whether the backup is successful or not?
You would need to configure ssmtp on your local device and then modify the script to shoot the mail out. Check out solution 13180 for details on ssmtp configuration: http://support.f5.com/kb/en-us/solutions/public/13000/100/sol13180.html
Now that 11.4 is out, there is a much simpler way to do config backups, all supported in tmsh, no cron or shell scripts required. Though if archiving off-box, you'll still need to do some ssh work on local and remote systems for key exchanges. Here's the iCall script and iApp:
https://devcentral.f5.com/wiki/iCall.Generate_Config_Backup.ashx
Exec: /usr/bin/scp -F /root/.ssh/f5archive_config /var/tmp/f5backup-filename-20140417155313.tar.bz2 username@host_ip:/archive/
Permission denied (password).
lost connection
Do you have any idea ?
Thanks
I have followed the new iAPP that you have pointed to me I have setup everything correctly and from F5 CLI i can upload file without password as SCP and SFTP however when I setup the via GUI it doesnt work I think because I am doing something wrong for "Enter the SSH private key to be used for passwordless authentication" and "Set the remote directory the archive should be copied to"
Is there log file I can look at to toubleshoot this issue?
for SSH private key should it be the id_rsa (under
/root/.ssh) and for
Set the remote directory the archive should be copied to does it use "\" or "/"
Can you please help me?
Thanks