cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1324
Views
0
Helpful
1
Replies

Monitor default route BGP - tcl

rob.stoop
Level 1
Level 1

In IOS we use the following EEM script to monitor the default route in BGP.


!
event manager applet MONITOR_DEFAULT_ROUTE_BGP
event routing network 0.0.0.0/0 protocol BGP vrf name INT
 action 1 set msg "Route changed: Type: $_routing_type, Network: $_routing_network"
 action 2 syslog msg "$msg"
 action 3 if $_routing_type eq "remove"
 action 4  track set 1 state down
 action 5 end
 action 6 if $_routing_type eq "add"
 action 7  track set 1 state up
 action 8 end
!

I want to convert this to IOS-XR where I must use tcl. I tried to use the EEM Applet to tcl policy tool (http://www.marcuscom.com/convert_applet/)

Receive the following errors. Or is there a beter solution?:

----------------------------------------------------------------------
 ::cisco::eem::event_register_routing network 0.0.0.0/0 protocol BGP vrf name INT

 namespace import ::cisco::eem::*
 namespace import ::cisco::lib::*

 array set arr_einfo [event_reqinfo]
invalid command name "event_reqinfo"

set msg "Route changed: Type: $arr_einfo(type), Network: $arr_einfo(network)"
can't read "arr_einfo(type)": no such variable
action_syslog msg "$msg"
can't read "msg": no such variable
if {$arr_einfo(type) == "remove"} {
   action_track_set 1 state down
}
can't read "arr_einfo(type)": no such variable
 if {$arr_einfo(type) == "add"} {
    action_track_set 1 state up
}
can't read "arr_einfo(type)": no such variable
----------------------------------------------------------------------

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

I don't believe XR supports the routing event detector yet, so it's likely this will not work.  I haven't checked very recent versions of XR, though.  And it looks like you're running this script through the Tcl shell as opposed to registering it as an EEM policy.  See http://www.cisco.com/c/en/us/td/docs/routers/crs/software/crs_r4-2/system_monitoring/configuration/guide/b_sysmon_cg42crs/b_sysmon_cg42crs_chapter_010.html#con_1027188 on how to register these policies.

Review Cisco Networking for a $25 gift card