Harshpal Bhati

Script to Automate GAIA Configuration backup

Discussion created by Harshpal Bhati Employee on Jul 2, 2018
Latest reply on Jul 6, 2018 by Dameon Welch Abernathy

Hi,

 

i wrote below script for my customer to automate gaia configuration backup of gateway . Script runs on management and it can fetch the "show configuration"  of all the gateway and create a file for individual gateway .

 

Steps :

 

Perform below on management server .

 

  1. Create a Directory called gaiagwbkp under /var/log
  2.  Create a file called gateway_ip_list.txt under /opt/CPsuite-R80/fw1/scripts and add ip address of the gateway which is being managed by same management server
  3. [Expert@PROD-MGMT-R80:0]# cat gateway_ip_list.txt
    10.1.1.254
    [Expert@PROD-MGMT-R80:0]#
  4. Create a file called gaiafwbkp.sh under /opt/CPsuite-R80/fw1/scripts and copy the script content and change file permission

*****************************************

[Expert@PROD-MGMT-R80:0]# cat gaiafwbkp.sh
#!/bin/sh
source /opt/CPshrd-R80/tmp/.CPprofile.sh
for dest in $(<gateway_ip_list.txt); do
hostname=`cprid_util -server $dest -verbose rexec -rcmd /bin/bash -c "hostname"`
now=$(date +"%m_%d_%Y")
cprid_util -server $dest -verbose rexec -rcmd /bin/clish -c "show configuration" > /var/log/gaiagwbkp/$hostname$now
done

************************************

4. run script gaiafwbkp.sh

5. Schedule job from GAIA portal using job scheduler 

6. if needed you can run another job to ftp this backup files to ftp server as well

Outcomes