cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2127
Views
7
Helpful
5
Replies

Run script when route is modified

BRUNO WOLLMANN
Level 1
Level 1

All,

I have the following EEM applet that will run successfully whenever an EIGRP route changes...

event manager applet eigrp_change

event routing network 0.0.0.0/0 type modify protocol EIGRP ge 1

action 1.0 set msg "$_routing_network/$_routing_mask via $_routing_lastgateway, $_routing_lastinterface"

action 2.0 syslog msg "$msg"

action 3.0 cli command "enable"

action 3.1 cli command "clear ip nhrp $_routing_network $_routing_mask"

action 4.0 cli command "end"

action 5.0 cli command "exit"

My question is:

How do I modify this script so that it only runs when the destination network is reachable via a new interface and not every time the route changes?  I don't see any variables to compare the old interface to the new interface to make this happen for each specific route.

Thanks,

Bruno Wollmann

5 Replies 5

BRUNO WOLLMANN
Level 1
Level 1

More info...

SNMP might be useful here as well.

The OID for the EIGRP table is 1.3.6.1.4.1.9.9.449.1.3.1.1.14.

After doing an SNMPWalk, the exact match for 172.30.1.48/29 is...

1.3.6.1.4.1.9.9.449.1.3.1.1.14.65536.10.1.4.172.30.1.48.29, Type=OctetString, Value=Tunnel10

When the value for any route changes to Tunnel20, I want to run a command against that specific route.  When it changes back to Tunnel10, I want to run the command again.

Thanks,

Bruno

If you only care about running this command when you get an update event (regardless of the parameter that changed), then you can do:

event manager applet eigrp_change

event routing network 0.0.0.0/0 type modify protocol EIGRP ge 1

action 1.0 set msg "$_routing_network/$_routing_mask via $_routing_lastgateway, $_routing_lastinterface"

action 2.0 syslog msg "$msg"

action 2.1 regexp "Tunnel(10|20)" $_routing_lastinterface

action 2.2 if $_regexp_result eq 1

action 3.0 cli command "enable"

action 3.1 cli command "clear ip nhrp $_routing_network $_routing_mask"

action 3.2 end

If you want to only do this when the interface changes, you're best bet is to use Tcl and store an array mapping routes to interfaces within an EEM context.  You can do contexts with applets, but the array would really work best here so you can look up a network/mask and get the previous next hop interface.

Hi Joesph,

Thanks for the reply.

I was thnking an array in TCL would work too but I am not a programmer by any stretch of the imagination

I'll do more reading and practicing to see if I can figure this out.

This brings me to two more questions...

1) If I have about 500 EIGRP routes in the routing table, do my ISR 1921, 2901 and 3925E routers have enough resources to store the array?

2) What kind of performance hit can I expect to notice on these same routers when doing array lookups (i.e. CPU utilization)?

Thanks,

Bruno

Short answer is maybe.  It will depend on how much free memory is available, and how many routes end up changing.  At maximim, you'd likely have around 25K of memory to store the necessary info.  Therefore, I'd think in practice the long answer would be yes.

An array lookup is quick.  It will not have a CPU impact.  The spinning up of Tcl will be a larger impact, and this will depend on how many routes change and how many parallel threads you allow to run.

Hi Joseph,

I appreciate your replies and expertise.  I'll look around for examples of using TCL scripts within EEM and see what I can come up with.

Thanks again,

Bruno