cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1467
Views
0
Helpful
2
Replies

EEM script to monitor primary link & secondary link and choose the Best.

makramccie
Level 1
Level 1

Need to monitor primary & Sec links, select the best based on the following criteria

 

1. Packet drops

2. Link flapping

3. Input Errors

4. Output drops

2 Replies 2

Joe Clarke
Cisco Employee
Cisco Employee

Given the number of criteria, you could have a policy that wakes up periodically, checks the output of "show interface" for the two interfaces in question, extracts the fields, reliability, drops, and errors; and then does whatever it takes to prefer one interface other the other.

 

One issue I see with this is that if traffic is diverted away from one interface, errors and drops will go to zero.  You could still measure reliability, though.  Another potential problem is ping-ponging between the two interfaces every time your policy runs.  So you'd need to think about thresholds to this.

 

Without all of the details, here is some pseudo-applet code that you could use as a model:

 

event manager environment primary_intf GigabitEthernet0/1

cli command "enable"

cli command "show interface $primary | inc reliability|output drops|input errors"

regexp "reliability ([0-9]+)/255.*Total output drops: ([0-9]+)" $_cli_result match rel drops

regexp "([0-9]+) input errors" $_cli_result match ierrs

if $rel lt $rel_threshold goto FAILOVER_LABEL

if $drops gt $drop_threshold goto FAILOVER_LABEL

if $ierrs gt $ierr_threshold goto FAILOVER_LABEL

! FAILOVER_LABEL would start here

cli command "config t"

! Do failover CLI

cli command "event manager environment primary_intf NEW_ACTIVE_INTF"

cli command "end"

cli command "clear counters NEW_ACTIVE_INTF"

 

Thanks Joseph. will try this and update..