Shut an interface if no ping response - using IP SLA + EEM?

Unanswered Question

I'm really new to IP SLA / Object Tracking, and somewhat familiar with EEM.


On my routers that all run IOS version 12.4 and higher, I need to trigger an interface to "shutdown", if there is no ping response from a specific IP address.


I *believe* I would need to configure an IP SLA to do a forever ping to the IP.


Then I need the loss of a ping to trigger a syslog message.  Not sure if this happens automatically, or if I need to configure the ip sla to trigger syslog when the ping is lost.


At which point I could configure an EEM script to shutdown the interface, should this ping-loss-syslog message appear.


Am I on the right track?  Any suggestions for the IP SLA config portion? 


Thanks!!

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4.7 (3 ratings)
Loading.
yjdabear Fri, 12/11/2009 - 13:06
User Badges:
  • Gold, 750 points or more

Here's my empirical stab at it:


track 100 rtr 99 reachability
delay down 10 up 60
! consider it "down" if down for 10 secs, consider it "up" if up for 60 secs
ip sla 99
icmp-echo 10.x.x.x source-interface s0/0/0
frequency 10
ip sla schedule 99 life forever start-time now
!
event manager environment _interface_to_shut fa0/0/0
event manager applet shut_some_interface

event track 151 state down
action 1 cli command "conf t"
action 2 cli command "interface $_interface_to_shut"
action 2 cli command "shut"
action 3 cli command "end"
action 4 syslog priority errors msg "10.x.x.x unpingable; shutting down $_interface_to_shut"
!


Note:

"Effective with Cisco IOS Release 12.4(20)T, 12.2(33)SXI1, 12.2(33)SRE and Cisco IOS XE Release 2.4,
the track rtr command is replaced by the track ip sla command."

Joe Clarke Fri, 12/11/2009 - 13:20
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

This applet is almost correct., but there is one big no-no.  Users must NEVER use '_' as the first character in a variable name.  Variables beginning with '_' are reserved for Cisco internal use.  The thing that will prevent it from working is that you forgot:


action 0 cli command "enable"


If you do not become enabled, nothing else will work.


Finally, this applet assumes 12.4(2)T or higher.  If the customer is running 12.4 mainline, this applet will not work as there is no Enhanced Object Tracking support.  A different approach would be required there.

yjdabear Mon, 12/14/2009 - 09:37
User Badges:
  • Gold, 750 points or more

It was certianly the "easy way out".

Please do share how to accomplish this with EEM 2.2/2.3 and/or without object tracking. I suppose it'd need Tcl scripting?

Joe Clarke Mon, 12/14/2009 - 13:31
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

For versions of code with the fix for CSCsh45081, you can use the syslog ED to react to the tracked object changing state:


event manager applet track-down

event syslog pattern "TRACKING-5-STATE: 10 .*Up->Down"

action 1.0 ...

Joe Clarke Mon, 12/14/2009 - 13:49
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

No.  The code in which these syslog messages was added generally means that EEM 2.1 will be required.

haomeister Wed, 04/02/2014 - 20:35
User Badges:

Thanks Joseph for your examples.

I have a question that's not entirely related to this topic, but what determines if a software image has Enhanced Object Tracking as an event available to EEM? 

I have a 3850 running cat3k_caa-universalk9.SPA.03.03.02.SE.150-1.EZ2.bin image, with ipservices enabled. However "track" is still not a supported event or a correlate trigger.

 

Cheers.

Joe Clarke Wed, 04/02/2014 - 21:13
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

The Catalyst images don't typically have the track ED.  However, you can usually work around that very easily by reacting to the syslog message generated when a tracked object changes state.

leon.mflai Wed, 09/18/2013 - 03:06
User Badges:

Hi Everyone,


To save cost, I want to see if we can monitor ping response by just EEM but no IPSLA (save Data License on ISR-G2 or IP Services License on Catalyst)


Any chance can we monitor ping response by just EEM and TCL script ?

Actions

This Discussion

Related Content