Interactive CLI commands

Unanswered Question
May 14th, 2012
User Badges:
  • Green, 3000 points or more

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

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Kevin Dorrell Mon, 05/14/2012 - 06:26
User Badges:
  • Green, 3000 points or more

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

Joe Clarke Mon, 05/14/2012 - 08:50
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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.

Actions

This Discussion

Related Content