For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Steven_Williams's avatar
Steven_Williams
Icon for Nimbostratus rankNimbostratus
Aug 19, 2014

Backing up F5 UCS file with solarwinds NCM

I am trying to accomplish an f5 backup using, eventually, solarwinds NCM module, but working on the script to use. I want to backup the UCS file and offload it to a SCP/SFTP server.

 

Some things I cant figure out is:

 

How to automate the SFTP sign-in with username and password. How to dynamically put dates on the config.ucs files and clean up after 5 days.

 

I am using tmsh. So far I have this:

 

[user@f5:Active] ~ tmsh user@F5(Active)(tmos) save /sys ucs /var/local/ucsbackup/config_backup.ucs

 

Again how to append the date to this file everytime the script runs and how to build sftp offloading into it.

 

4 Replies

  • to specifically answer the question on how to name the file, from a bash shell(not a tmos shell) you can do:

    tmsh save /sys ucs /var/local/ucsbackup/config_backup-`date +%Y%m%d`.ucs
    

    Where %Y%m%d is the date format. see the man page on date for more options, the above is YYYYMMDD, or 20140819 for today.

    As far as the rest, what precisely is the process? Are you wanting to have the F5 create the UCS, push it to Solarwinds via SFTP, and then cleanup? Does solarwinds support key-based authentication?

    • Steven_Williams's avatar
      Steven_Williams
      Icon for Nimbostratus rankNimbostratus
      Solarwinds is just going to run the commands that I enter into the script. But when the prompt stops at password and waits for a password to enter...I need a way to tell the script to "expect this" and "enter this"
    • Steven_Williams's avatar
      Steven_Williams
      Icon for Nimbostratus rankNimbostratus
      ran into another issue: [user@f5:Active] ~ tmsh save /sys ucs /var/local/ucsbackup/config_backup-`date +%Y%m%d`.ucs Saving active configuration... [user@f5:Active] ~ ls /var/local/ucsbackup/ config_backup-20140819.ucs config_backup.ucs [user@f5:Active] ~ sftp f5backup@10.247.160.208 Connecting to 10.247.160.208... f5backup@10.247.160.208's password: sftp> put /var/local/ucsbackup/config_backup-`date +%Y%m%d`.ucs / File "/var/local/ucsbackup/config_backup-`date" not found. sftp> I guess I would just have to move the whole folder to get around not having to specify the exact name of the file?
    • mimlo_61970's avatar
      mimlo_61970
      Icon for Cumulonimbus rankCumulonimbus
      The SFTP shell will not understand the `date` syntax, only the bash shell will. You could and use sftp in batch mode, but it looks like Solarwinds NCM support SCP, so I would recomend you go that route cleanup a bit with a variable filename="/var/local/ucsbackup/config_backup-`date +%Y%m%d`.ucs" tmsh save /sys ucs ${filename} scp ${filename} f5backup@10.247.160.208: (and enter password if you haven't set up key based authentication yet) Of course beyond that comes all the error check, notifications if it fails and so on. Have you looked at this? http://sourceforge.net/projects/f5configbackup/