UPM: Scheduled backup of the configuration

This howto describes the procedure to do a scheduled backup of switch configuration. To do this job Universal Port (UP) can be used as it can react to several events:

"...

- User login and logoff
- Device connection to or disconnection from a port
- Time of day
- Event Management System event messages ..."

The procedure is identical for all Universal Port scripts: Create a profile which contains the commands itself, then a timer (Event) which contains the schedule and finally link those two together.

A working script looks as follows:  
create up profile PBackupCFG
create log entry "Backup configuration"
upload configuration 172.18.0.193 /data/tftproot/up/sw211.xsf vr "VR-Default"
.
   
configure upm profile PBackupCFG maximum execution-time 60
   
create upm timer TBackupCFG
configure upm timer TBackupCFG at 06 16 2011 9 0 0 every 86400
configure upm timer TBackupCFG profile PBackupCFG
  Line 1 creates a profile named "PBackupCFG". Line 2 to 4 contain the commands that get executed on event (defined later). Line 2 creates an event in log. 172.18.0.193 in line 3 represents the IP of TFTP server which accepts files from the IP of the switch. After this the target path and filename for configuration upload are defined, directly followed by the VR used. Line 4 ends the command lines. Line 6 defines the maximum execution time the script may run. A new timer named "TBackupCFG" is created which is defined further in line 9. This timer should run at 09:00 every 86400 seconds (1 day) starting at 06/16/2011. Line 10 does the final linking from profile and timer. That's all to do a scheduled backup of the switch configuration to a TFTP server every day at 09:00. The current date and time can be added to the filename too- of course. This is done this way (using some variables too):  
set var tftphost 172.18.0.193
set var tftppath /data/tftproot/up/
delete var "CLI.OUT"
set var CLI.OUT " "
show switch
set var switchname $TCL(lrange ${CLI.OUT} 1 1)
set var baseSystemTime $TCL(clock seconds)
set var timestamp $TCL(clock format $baseSystemTime -format {%Y%m%d-%H%M%S})
set var filename $(timestamp)-$(switchname).xsf
create log entry "Backup configuration for $(switchname) as $(tftppath)/$(filename) to $(tftphost)"
upload configuration $(tftphost) $(tftppath)$(filename) vr "VR-Default"