Thursday, May 18, 2023

Brocade: Setting up a periodic backup of the configuration of an optical switch using the SCP protocol

To perform the task of creating periodic backups of switch configurations, we will use a host with an installed SSH server. 

Let's go through the following steps:

1. For the convenience of connecting via SSH using a script, install the "sshpass" utility.

2. Let's create a user in the server OS, which will have the rights to connect via the SCP protocol and write to the required directory of the configuration file.

3. Create a script, for example "brocade.sh", and add commands for backing up optical switches in the following form:

sshpass -p Switch_Pass ssh Switch_Address -l Switch_User configupload -all -p scp -P 22 -cra Server_Address,Server_User,config-o-rez-$(date -I).txt,Server_Pass;exit

where Switch_Address - optical switch address;
Switch_User - optical switch user;
Switch_Pass - optical switch user's password;
Server_Address - SSH server address;
Server_User - user to connect to the server via SSH;
Server_Pass - SSH server user's password.

4. Add to the task scheduler ("cron") the execution of this script with the necessary periodicity. For example, to run on the first Monday of every month at 7 am:

0 7 1-7 * 1 /path/to/brocade.sh

 

No comments:

Post a Comment