Configuring Object Tracking

This chapter contains the following sections:

Information about object tracking

Object tracking is a feature that allows you to monitor specific objects on a device and take action when their state changes.

  • Tracks objects such as interface line protocol state, IP routing, and route reachability.

  • Enables actions to be triggered when the tracked object’s state changes.

  • Increases network availability and shortens recovery time if an object state goes down.

Object tracking overview

Object tracking is a feature that enables monitoring of specific objects on a device and allows actions to be taken when the state of those objects changes.

  • Tracks objects such as interface line protocol state, IP routing state, and route reachability.

  • Allows multiple clients to register interest and take action when a tracked object changes state.

  • Each tracked object is identified by a unique number for client configuration.

Clients and object types for object tracking

The object tracking feature allows multiple clients to use tracked objects to modify their behavior when the object state changes. Clients register with the tracking process and can take different actions based on the tracked object's state.

Clients that use object tracking include:

  • Embedded Event Manager (EEM)

  • Hot Standby Redundancy Protocol (HSRP)

  • Virtual port channel (vPC)

  • Virtual Router Redundancy Protocol (VRRP) and VRRPv3

The following object types can be tracked:

  • Interface line protocol state—Tracks whether the line protocol state is up or down.

  • Interface IP routing state—Tracks whether the interface has an IPv4 or IPv6 address and if IPv4 or IPv6 routing is enabled and active.

  • IP route reachability—Tracks whether an IPv4 or IPv6 route exists and is reachable from the local device.

Example of object tracking with HSRP

For example, you can configure HSRP to track the line protocol of the interface that connects one of the redundant routers to the rest of the network. If that link protocol goes down, you can modify the priority of the affected HSRP router and cause a switchover to a backup router that has better network connectivity.

Object track list

An object track list is a mechanism that enables tracking of the combined states of multiple objects using Boolean logic or threshold-based evaluation.

  • Supports Boolean "and" function: All objects in the track list must be up for the track list to be up.

  • Supports Boolean "or" function: At least one object in the track list must be up for the track list to be up.

  • Supports threshold percentage and threshold weight evaluation for determining the up or down state of the track list.

Object track list capabilities and usage

Object track lists support the following capabilities:

  • Boolean "and" function —Each object defined within the track list must be in an up state so that the track list object can become up.

  • Boolean "or" function —At least one object defined within the track list must be in an up state so that the tracked object can become up.

  • Threshold percentage —The percentage of up objects in the tracked list must be greater than the configured up threshold for the tracked list to be in the up state. If the percentage of down objects in the tracked list is above the configured track list down threshold, the tracked list is marked as down.

  • Threshold weight —Assign a weight value to each object in the tracked list and a weight threshold for the track list. If the combined weights of all up objects exceed the track list weight up threshold, the track list is in an up state. If the combined weights of all the down objects exceed the track list weight down threshold, the track list is in the down state.

Other entities, such as virtual port channels (vPCs), can use an object track list to modify the state of a vPC based on the state of the multiple peer links that create the vPC.

See the Cisco Nexus 9000 Series NX-OS Interfaces Configuration Guide for more information on vPCs.

See the Configuring an Object Track List with a Boolean Expression section for more information on track lists.

High availability

High availability is a network feature that ensures continuous operation by minimizing downtime through mechanisms such as stateful restarts and switchovers.

  • Object tracking supports high availability through stateful restarts when the tracking process crashes.

  • Object tracking supports stateful switchover on dual-supervisor systems.

  • Object tracking can modify client behavior to improve overall network availability.

Object tracking enables high availability by maintaining configuration and state during process restarts and supervisor switchovers.

Virtualization support

Virtualization support in object tracking enables monitoring of route reachability for objects within different VRF instances.

  • By default, Cisco NX-OS tracks the route reachability state of objects in the default VRF.

  • You can configure object tracking for nondefault VRFs by assigning the object to the desired VRF.

Object tracking supports both default and nondefault VRF instances. To track objects in a nondefault VRF, configure the object as a member of that VRF.

For more information, see the Configuring Object Tracking for a Nondefault VRF section.

Configuration examples for object tracking

Object tracking configuration allows you to monitor the reachability of a route and associate the tracking with a specific VRF instance.

  • Enables tracking of route reachability.

  • Associates the tracked object with a VRF (Virtual Routing and Forwarding) instance.

  • Configuration is saved to persist across reloads.

Object tracking configuration for route reachability using VRF

This section provides a configuration example for tracking the reachability of a route and associating it with a VRF instance.

  • Configure object tracking for a specific route.

  • Assign the tracked object to a VRF.

  • Save the configuration.

  1. Enter global configuration mode.

  2. Configure object tracking for the route 209.165.201.0/8.

  3. Associate the tracked object with VRF Red.

  4. Save the running configuration to startup configuration.

Example: Configuring object tracking for route reachability with VRF Red

The following example shows the CLI commands to configure object tracking for route 209.165.201.0/8 and associate it with VRF Red:

switch# configure terminal
switch(config)# track 2 ip route 209.165.201.0/8 reachability
switch(config-track)# vrf member Red
switch(config-track)# copy running-config startup-config
			

Guidelines and limitations for object tracking

  • Supports Ethernet, subinterfaces, port channels, loopback interfaces, and VLAN interfaces.

  • Supports one tracked object per HSRP group.

  • VRRP and VRRPv3 support object tracking. For more information and configuration instructions, see Configuring VRRP .

Default settings

The following table lists the default settings for object tracking parameters.

Table 1. Default object tracking parameters

Parameters

Default

Tracked object VRF

Member of default VRF

Configure object tracking

Configuring object tracking refers to the process of setting up mechanisms to monitor and track the state of network objects, such as IP SLA operations.

For detailed configuration steps and additional information, refer to the following guide:

Configure object tracking for an interface

You can configure Cisco NX-OS to track the line protocol or IPv4 or IPv6 routing state of an interface.

Procedure


Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

track object-id interface interface-type number { ip routing | ipv6 routing | line-protocol }

Example:

switch(config)# track 1 interface ethernet 1/2 line-protocol
switch(config-track)#

Creates a tracked object for an interface and enters tracking configuration mode. The object-id range is from 1 to 512.

Step 3

(Optional) show track [ object-id ]

Example:

switch(config-track)# show track 1

Displays object tracking information.

Step 4

(Optional) copy running-config startup-config

Example:

switch(config-track)# copy running-config startup-config

Copies the running configuration to the startup configuration.


This example shows how to configure object tracking for the line protocol state on Ethernet 1/2:

switch# configure terminal
switch(config)# track 1 interface ethernet 1/2 line-protocol
switch(config-track)# copy running-config startup-config

This example shows how to configure object tracking for the IPv4 routing state on Ethernet 1/2:

sswitch# configure terminal
switch(config)# track 2 interface ethernet 1/2 ip routing
switch(config-track)# copy running-config startup-config

This example shows how to configure object tracking for the IPv6 routing state on Ethernet 1/2:

switch# configure terminal
switch(config)# track 3 interface ethernet 1/2 ipv6 routing
switch(config-track)# copy running-config startup-config

Delete a tracking object

Procedure


Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

no track object-id

Example:

switch(config)# no track 1
switch(config-track)#

Deletes a tracked object for an interface. The object-id range is from 1 to 512.

Step 3

(Optional) copy running-config startup-config

Example:

switch(config-track)# copy running-config startup-config

Copies the running configuration to the startup configuration.


This example shows how to delete a tracked object:

switch# configure terminal
switch(config)# no track 1
switch(config-track)# copy running-config startup-config

Configure object tracking for route reachability

You can configure Cisco NX-OS to track the existence and reachability of an IP route or an IPv6 route.

Procedure


Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

track object-id { ip | ipv6 } route prefix / length reachability

Example:

switch(config)# track 3 ipv6 route 2::5/64 reachability
switch(config-track)#

Creates a tracked object for a route and enters tracking configuration mode. The object-id range is from 1 to 512. The prefix format for IPv4 is A.B.C.D/length, where the length range is from 1 to 32. The prefix format for IPv6 is A:B::C:D/length, where the length range is from 1 to 128.

Step 3

(Optional) show track [ object-id ]

Example:

switch(config-track)# show track 1

Displays object tracking information.

Step 4

(Optional) copy running-config startup-config

Example:

switch(config-track)# copy running-config startup-config

Copies the running configuration to the startup configuration.


This example shows how to configure object tracking for an IPv4 route in the default VRF:

switch# configure terminal
switch(config)# track 4 ip route 192.0.2.0/8 reachability
switch(config-track)# copy running-config startup-config

This example shows how to configure object tracking for an IPv6 route in the default VRF:

switch# configure terminal
switch(config)# track 5 ipv6 route 10::10/128 reachability
switch(config-track)# copy running-config startup-config

Configure an object track list with a boolean expression

You can configure an object track list that contains multiple tracked objects. A tracked list contains one or more objects. The Boolean expression enables two types of calculation by using either "and" or "or" operators. For example, when tracking two interfaces using the "and" operator, up means that both interfaces are up, and down means that either interface is down.

Procedure


Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#
					

Enters global configuration mode.

Step 2

track track-number list boolean { and | or }

Example:

switch(config)# track 1 list boolean and
switch(config-track)#

Configures a tracked list object and enters tracking configuration mode. Specifies that the state of the tracked list is based on a Boolean calculation. The keywords are as follows:

  • and —Specifies that the list is up if all objects are up or down if one or more objects are down. For example, when tracking two interfaces, up means that both interfaces are up, and down means that either interface is down.

  • or —Specifies that the list is up if at least one object is up. For example, when tracking two interfaces, up means that either interface is up, and down means that both interfaces are down.

The track-number range is from 1 to 512.

Step 3

object object-number [ not ]

Example:

switch(config-track)# object 10

Adds a tracked object to the track list. The object-id range is from 1 to 512. The not keyword optionally negates the tracked object state.

Note

 

The example means that when object 10 is up, the tracked list detects object 10 as down.

Step 4

(Optional) show track [ object-id ]

Example:

switch(config-track)# show track
					

Displays object tracking information.

Step 5

(Optional) copy running-config startup-config

Example:

switch(config-track)# copy running-config startup-config
					

Copies the running configuration to the startup configuration.


This example shows how to configure a track list with multiple objects as a Boolean “and”:

switch# configure terminal
switch(config)# track 1 list boolean and
switch(config-track)# object 10
switch(config-track)# object 20 not

Configure an object track list with a percentage threshold

You can configure an object track list that contains a percentage threshold. A tracked list contains one or more objects. The percentage of up objects must exceed the configured track list up percent threshold before the track list is in an up state. For example, if the tracked list has three objects and you configure an up threshold of 60 percent, two of the objects must be in the up state (66 percent of all objects) for the track list to be in the up state.

Procedure


Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#
					

Enters global configuration mode.

Step 2

track track-number list threshold percentage

Example:

switch(config)# track 1 list threshold percentage
switch(config-track)#

Configures a tracked list object and enters tracking configuration mode. Specifies that the state of the tracked list is based on a configured threshold percent.

The track-number range is from 1 to 512.

Step 3

threshold percentage up up-value down down-value

Example:

switch(config-track)# threshold percentage up 70 down 30

Configures the threshold percent for the tracked list. The range is from 0 to 100 percent.

Step 4

object object-id

Example:

switch(config-track)# object 10

Adds a tracked object to the track list. The object-id range is from 1 to 512.

Step 5

(Optional) show track [ object-id ]

Example:

switch(config-track)# show track

Displays object tracking information.

Step 6

(Optional) copy running-config startup-config

Example:

switch(config-track)# copy running-config startup-config
					

Copies the running configuration to the startup configuration.


This example shows how to configure a track list with an up threshold of 70 percent and a down threshold of 30 percent:

switch# configure terminal
switch(config)# track 1 list threshold percentage
switch(config-track)# threshold percentage up 70 down 30
switch(config-track)# object 10
switch(config-track)# object 20
switch(config-track)# object 30

Configure an object track list with a weight threshold

You can configure an object track list that contains a weight threshold. A tracked list contains one or more objects. The combined weight of up objects must exceed the configured track list up weight threshold before the track list is in an up state. For example, if the tracked list has three objects with the default weight of 10 each, and you configure an up threshold of 15, two of the objects must be in the up state (combined weight of 20) for the track list to be in the up state.

Procedure


Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#
					

Enters global configuration mode.

Step 2

track track-number list threshold weight

Example:

switch(config)# track 1 list threshold weight
switch(config-track)#

Configures a tracked list object and enters tracking configuration mode. Specifies that the state of the tracked list is based on a configured threshold weight.

The track-number range is from 1 to 512.

Step 3

threshold weight up up-value down down-value

Example:

switch(config-track)# threshold weight up 30 down 10

Configures the threshold weight for the tracked list. The range is from 1 to 255.

Step 4

object object-id weight value

Example:

switch(config-track)# object 10 weight 15

Adds a tracked object to the track list. The object-id range is from 1 to 512. The value range is from 1 to 255. The default weight value is 10.

Step 5

(Optional) show track [ object-id ]

Example:

switch(config-track)# show track

Displays object tracking information.

Step 6

(Optional) copy running-config startup-config

Example:

switch(config-track)# copy running-config startup-config
					

Copies the running configuration to the startup configuration.


This example shows how to configure a track list with an up weight threshold of 30 and a down threshold of 10:

switch# configure terminal
switch(config)# track 1 list threshold weight
switch(config-track)# threshold weight up 30 down 10
switch(config-track)# object 10 weight 15
switch(config-track)# object 20 weight 15
switch(config-track)# object 30
			

In this example, the track list is up if object 10 and object 20 are up, and the track list goes to the down state if all three objects are down.

Configure an object tracking delay

You can configure a delay for a tracked object or an object track list that delays when the object or list triggers a stage change. The tracked object or track list starts the delay timer when a state change occurs but does not recognize a state change until the delay timer expires. At that point, Cisco NX-OS checks the object state again and records a state change only if the object or list currently has a changed state. Object tracking ignores any intermediate state changes before the delay timer expires.

For example, for an interface line-protocol tracked object that is in the up state with a 20-second down delay, the delay timer starts when the line protocol goes down. The object is not in the down state unless the line protocol is down 20 seconds later.

You can configure independent up delay and down delay for a tracked object or track list. When you delete the delay, object tracking deletes both the up and down delay.

You can change the delay at any point. If the object or list is already counting down the delay timer from a triggered event, the new delay is computed as follows:

  • If the new configuration value is less than the old configuration value, the timer starts with the new value.

  • If the new configuration value is more than the old configuration value, the timer is calculated as the new configuration value minus the current timer countdown minus the old configuration value.

Procedure


Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#
					

Enters global configuration mode.

Step 2

track object-id { parameters }

Example:

switch(config)# track 2 ip route 192.0.2.0/8 reachability
switch(config-track)#

Creates a tracked object for a route and enters tracking configuration mode. The object-id range is from 1 to 512. The prefix format for IPv4 is A.B.C.D/length, where the length range is from 1 to 32. The prefix format for IPv6 is A:B::C:D/length, where the length range is from 1 to 128.

Step 3

track track-number list { parameters }

Example:

switch(config)# track 1 list threshold weight
switch(config-track)#

Configures a tracked list object and enters tracking configuration mode. Specifies that the state of the tracked list is based on a configured threshold weight.

The track-number range is from 1 to 512.

Step 4

delay { up up-time [ down down-time ] | down down-time [ up up-time ]}

Example:

switch(config-track)# delay up 20 down 30

Configures the object delay timers. The range is from 0 to 180 seconds.

The track-number range is from 1 to 512.

Step 5

(Optional) show track [ object-id ]

Example:

switch(config-track)# show track 3

Displays object tracking information.

Step 6

(Optional) copy running-config startup-config

Example:

switch(config-track)# copy running-config startup-config
					

Copies the running configuration to the startup configuration.


This example shows how to configure object tracking for a route and use delay timers:

switch# configure terminal
switch(config)# track 2 ip route 209.165.201.0/8 reachability
switch(config-track)# delay up 20 down 30
switch(config-track)# copy running-config startup-config

This example shows how to configure a track list with an up weight threshold of 30 and a down threshold of 10 with delay timers:

switch# configure terminal
switch(config)# track 1 list threshold weight
switch(config-track)# threshold weight up 30 down 10
switch(config-track)# object 10 weight 15
switch(config-track)# object 20 weight 15
switch(config-track)# object 30
switch(config-track)# delay up 20 down 30

This example shows the delay timer in the show track command output before and after an interface is shut down:

switch(config-track)# show track
Track 1
Interface loopback1 Line Protocol
Line Protocol is UP
1 changes, last change 00:00:13
Delay down 10 secs
switch(config-track)# interface loopback 1
switch(config-if)# shutdown
switch(config-if)# show track
Track 1
Interface loopback1 Line Protocol
Line Protocol is delayed DOWN (8 secs remaining) <------- delay timer counting down
1 changes, last change 00:00:22
Delay down 10 secs

Configure object tracking for a nondefault VRF

Configure object tracking for a route in a nondefault VRF.

You can configure Cisco NX-OS to track an object in a specific VRF.

Before you begin

Ensure that nondefault VRFs are created first.

Procedure


Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#
					

Enters global configuration mode.

Step 2

track object-id { ip | ipv6 } route prefix/length reachability

Example:

switch(config)# track 3 ipv6 route 1::2/64 reachability
switch(config-track)# 

Creates a tracked object for a route and enters tracking configuration mode. The object-id range is from 1 to 512. The prefix format for IPv4 is A.B.C.D/length, where the length range is from 1 to 32. The prefix format for IPv6 is A:B::C:D/length, where the length range is from 1 to 128.

Step 3

vrf member vrf-name

Example:

switch(config-track)# vrf member Red

Configures the VRF to use for tracking the configured object.

Step 4

(Optional) show track [ object-id ]

Example:

switch(config-track)# show track 3

Displays object tracking information.

Step 5

(Optional) copy running-config startup-config

Example:

switch(config-track)# copy running-config startup-config
					

Copies the running configuration to the startup configuration.


This example shows how to configure object tracking for a route and use VRF Red to look up reachability information for this object:

switch# configure terminal
switch(config)# track 2 ip route 209.165.201.0/8 reachability
switch(config-track)# vrf member Red
switch(config-track)# copy running-config startup-config

This example shows how to configure object tracking for an IPv6 route and use VRF Red to look up reachability information for this object:

switch# configure terminal
switch(config)# track 3 ipv6 route 1::2/64 reachability
switch(config-track)# vrf member Red
switch(config-track)# copy running-config startup-config

This example shows how to modify tracked object 2 to use VRF Blue instead of VRF Red to look up reachability information for this object:

switch# configure terminal
switch(config)# track 2
switch(config-track)# vrf member Blue
switch(config-track)# copy running-config startup-config

Verify the object tracking configuration

To display object tracking configuration information, perform one of the following tasks.

Command

Purpose

show track [ object-id ] [ brief ]

Displays the object tracking information for one or more objects.

show track [ object-id ] interface [ brief ]

Displays the interface-based object tracking information.

show track [ object-id ] { ip | ipv6 } route [ brief ]

Displays the IPv4 or IPv6 route-based object tracking information.

Configuration examples for object tracking

Object tracking configuration allows you to monitor the reachability of a route and associate the tracking with a specific VRF instance.

  • Enables tracking of route reachability.

  • Associates the tracked object with a VRF (Virtual Routing and Forwarding) instance.

  • Configuration is saved to persist across reloads.

Object tracking configuration for route reachability using VRF

This section provides a configuration example for tracking the reachability of a route and associating it with a VRF instance.

  • Configure object tracking for a specific route.

  • Assign the tracked object to a VRF.

  • Save the configuration.

  1. Enter global configuration mode.

  2. Configure object tracking for the route 209.165.201.0/8.

  3. Associate the tracked object with VRF Red.

  4. Save the running configuration to startup configuration.

Example: Configuring object tracking for route reachability with VRF Red

The following example shows the CLI commands to configure object tracking for route 209.165.201.0/8 and associate it with VRF Red:

switch# configure terminal
switch(config)# track 2 ip route 209.165.201.0/8 reachability
switch(config-track)# vrf member Red
switch(config-track)# copy running-config startup-config
			

Additional references

This topic provides references for further information on object tracking implementation.

For additional information related to implementing object tracking, see the following section: