03-10-2020 09:43 AM - edited 03-10-2020 09:44 AM
Hi,
I'm trying to automate backup configurations from our 5Ks. I understand the archive command is not supported on the 5K and we've used that successfully on our IOS gear.
Below is my EEM script...can anyone see an issue with it?
Curiously, the command below does work:
copy running-config scp://netconfiguser:password@ip_address/folder-Configs/filename- vrf VRF_INTERNAL
The config is sent to our server and placed in the folder
The EEM script is not working. It goes to the server...I can see a notification pop up on my windows server, but I believe it could be having an auth issue created by the order of operations.
NEX01(config)# event manager applet CONFIG-BACKUP-TO-SCP-SERVER
NEX01(config-applet)# description "Copy running-config to SCP server"
NEX01(config-applet)# event cli match "copy running-config startup-config"
NEX01(config-applet)# action 1.0 cli copy running-config startup-config
NEX01(config-applet)# action 2.0 cli copy running-config scp://netconfiguser:password@ip_address/folder-Configs/filename- vrf VRF_INTERNAL
Thank you, Pat
03-10-2020 09:57 AM
03-12-2020 10:25 AM
Thanks, Mark.
My script appears to be sending the copy scp command to the server, but I believe the server is asking for a password and my script is not sending it....so it hangs. When I run the copy running-config scp command manually I get a password prompt.
copy running-config scp://user:password@172.X.X.X/folder-Configs/file- vrf EXAMPLEVRF
user@172.X.X.X's password:
I enter the password and the configuration is sent to my server and saved in the folder.
If I could send a password through the script, then I think it would work.
I tried the below, but it did not work.
event manager applet CONFIG-BACKUP-TO-SCP-SERVER
event cli match "copy running-config startup-config"
action 1.0 cli copy running-config scp://user:password@172.X.X.X/folder-Configs/file- vrf EXAMPLEVRF
action 2.0 password
Also, tried
event manager applet CONFIG-BACKUP-TO-SCP-SERVER
event cli match "copy running-config startup-config"
action 1.0 cli copy running-config scp://user:password@172.X.X.X/folder-Configs/file- vrf EXAMPLEVRF
action 1.1 password
Thank you, Pat
01-22-2021 05:23 AM
try:
action 1.0 cli "copy running-config scp://user:password@172.X.X.X/folder-Configs/file- vrf EXAMPLEVRF" pattern "password"
01-22-2021 06:25 AM
Hello
Below are the scripts ive used in the past.
N7-9kscli alias name NetcmBackup copy startup-config tftp://x.x.x.x/$(SWITCHNAME)__$(TIMESTAMP).cfg vrf default
config terminal
scheduler job name switchbackup_to_Netcm
NetcmBackup
end
config terminal
scheduler schedule name NETCM_Backup
time daily 23:59
job name switchbackup_to_Netcm
end
N5Ks
cli alias name NetcmBackup copy startup-config tftp://x.x.x.x/$(SWITCHNAME)__$(TIMESTAMP).cfg vrf default
event manager applet Netcm_Backup
event snmp oid 1.3.6.1.4.1.9.9.109.1.1.1.1.6.1 get-type exact entry-op le entry-val 12345 poll-interval 86400
action 1.1 cli command "enable"
action 1.2 cli command "NetcmBackup"
action 1.3 syslog priority notifications msg "Running_config_backup_to_Netcm_Complete"
action 1.4 cli command "end"
01-22-2021 06:38 AM
is there a working script for scp on N5K? It does not work for me.
Probably because there are two prompts, for unknown server ssh key first time and for scp password. I used pattern "password" but it fails. Also not sure how to run proper debug to see what is going on.
'Show event manager events action ' does not give much info.
01-29-2021 12:35 PM
Igoris,
What I did in the end was create an alias for "wr"
cli alias name wr copy running-config scp://user:password@X.X.X.X/NEXUS-SWITCH-Configs/NEXUS-SWITCH-Config-$(TIMESTAMP) vrf VRF_EXAMPLE
This is not a scheduled task, but the next best thing. So every time I issue "wr" it goes right to my SFTP server and into a folder I've created just for the Nexus with timestamp.
HTH, Pat
01-29-2021 08:47 PM
Hello Pat
Glad you have managed to get it to work,
For the 5K's in my example above I've just gave the alias a different name but just confirm the last time i checked my backups for the 5ks were initiating every 24 hrs
02-01-2021 04:21 AM
nice idea, but it prompts me for password, in spite of it is specified in the line.
And other thing- I need to instruct all engineers to use alias wr.
02-01-2021 04:58 AM
Yea - actually forgot about the prompting for password...sort of a pain in the butt.
Agreed, not a perfect solution, but I needed to move on as I couldn't get it to work totally automated within a reasonable amount of time. Since I only have 2 Nexuses it's not a big deal for me. The important thing is I'm saving my configs.
Thx
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide