Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

Interactive CLI commands

I'm quite new to EEM, so please bear with me.

How can I handle interactive CLI commands. I want a script that detects when a configuration change has been made, and then copies the running configuration to a TFTP server.  This is what I have tried:

event manager applet Configured

event syslog pattern ".*%SYS-5-CONFIG_I.*"

action 10 cli command "enable"

action 20 cli command "copy run tftp"

action 30 gets response

action 40 puts "MyTFTPServer"

action 50 gets response

action 60 puts "MyRtr.run"

action 70 end

All that happens is:

No.  Job Id Proc Status  Time of Event            Event Type        Name

1    1      Actv abort    Mon May14 13:53:35 2012  syslog            applet: Configured

2    2      Actv abort    Mon May14 13:53:46 2012  syslog            applet: Configured

3    3      Actv abort    Mon May14 14:01:32 2012  syslog            applet: Configured

4    4      Actv abort    Mon May14 14:02:11 2012  syslog            applet: Configured

5    5      Actv abort    Mon May14 14:05:01 2012  syslog            applet: Configured

6    6      Actv abort    Mon May14 14:06:18 2012  syslog            applet: Configured

7    7      Actv abort    Mon May14 14:08:49 2012  syslog            applet: Configured

(You see how many times I have tried to get it working ;-)  The problem seems to be the interactivity of the "copy run tftp" command.

Can someone give me some guidance please?

Kevin Dorrell

Luxembourg

Everyone's tags (3)
2 REPLIES

Re: Interactive CLI commands

OK, I got it

      

event manager applet Configured

event syslog pattern ".*%SYS-5-CONFIG_I."

action 10 cli command "enable"

action 20 cli command "copy run tftp" pattern "Address or name of remote host.*"

action 30 cli command "MyTFTPServer" pattern "Destination filename.*"

action 40 cli command "MyRtr.run"

Kevin Dorrell

Luxembourg

Cisco Employee

Interactive CLI commands

Yep, you got it.  Just a hint, you don't need to be so complex with your patterns.  All you need to do is match one bit of the prompt.  So you could use "Address" and "Destination" as your prompt patterns.

1403
Views
0
Helpful
2
Replies
CreatePlease login to create content