cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2829
Views
10
Helpful
4
Replies

Object tracking default-state not working?

chris.wilson
Level 1
Level 1

I am using an object tracker to trigger an EEM applet to bypass a device when the object is not reachable.  The bypass is achieved by changing the dot1q encapsulation on the 174 sub-interface to 175, the default encapsulation for this interface is 174. 

!

ip sla 2

icmp-echo 10.230.68.218 source-interface GigabitEthernet0/1.174

timeout 1000

threshold 30000

frequency 1

ip sla schedule 2 life forever start-time now

!

track 2 ip sla 2 reachability

!

event manager applet BYPASS

event track 2 state down

action 1 cli command "enable"

action 2 cli command "config t"

action 3 cli command "int Gi0/1.174"

action 4 cli command "encapsulation dot1q 175"

action 5 syslog msg "Device Bypassed on Gi0/1.174"

action 6 snmp-trap strdata "DEVICE-BYPASSED"

!

event manager applet UNBYPASS

event track 2 state up

action 1 cli command "enable"

action 2 cli command "config t"

action 3 cli command "int Gi0/1.174"

action 4 cli command "encapsulation dot1q 174"

action 5 syslog msg "Device Unbypassed on Gi0/1.174"

action 6 snmp-trap strdata "DEVICE-UNBYPASSED"

!

This works as expected except in the case where the tracked object is not reachable on initial router boot, in this case the router doesn’t detect a transition of the tracking object from up -> down and therefore does not execute the associated EEM applet.  I attributed this to the router having a default object state of down and tried setting the default state to up using the following line, but this had no effect.


!

track 2 ip sla 2 reachability

default-state up

!

I also tried changing the object tracking type from reachability to state but did have any effect either.

I was able to get this to work by changing the default encapsulation of the 174 sub-int to 175 but I would prefer not to do this since it may be misinterpreted by the user. Is there another way to accomplish this or is there an IOS bug here?

4 Replies 4

yjdabear
VIP Alumni
VIP Alumni

It reads to me that the "default-state" command is only applicable to "stub objects" (created by entering "track [object number] stub"). So that may explain why that approach has no effect.


KR ISG Network
Level 1
Level 1

Hi Christopher, Have you ever managed to resolve this? We're having the same issue when the tracked object remains unreachable/down after router reload.  EEM apears to need a track state change to kick in (up->down). 

I ended up creating a second object tracker (102 in the below example) that tracks the first object (2 in the below example) such that it is only up when the other is down.  This way only one of the 2 object can ever be up at one time and you can trigger the eem applets based on this.  Have been using this for several years in a fielded system no issues.

!

ip sla 2

icmp-echo 10.10.10.10 source-interface GigabitEthernet0/0.174

timeout 1000

threshold 30000

frequency 1

!

ip sla schedule 2 life forever start-time now

!

track 2 ip sla 2 reachability

delay down 3 up 3

!

track 102 list boolean and

object 2 not

!

event manager applet BYPASS

event track 102 state up

action 010 cli command "enable"

action 020 cli command "config t"

action 100 cli command "int Gi0/0.174"

action 101 cli command "encapsulation dot1q 175"

!

event manager applet UNBYPASS

event track 2 state up

action 010 cli command "enable"

action 020 cli command "config t"

action 100 cli command "int Gi0/0.174"

action 101 cli command "encapsulation dot1q 174"

!

Thanks Chris, I've just tested your workaround in the lab and it worked just fine. Going to prod tomorrow. Thanks again!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: