cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2293
Views
10
Helpful
7
Replies

EEM Script to shutdown BGP Neighbor

Jason Bandy
Level 1
Level 1

Does anyone have any simple EEM Scripts handy that can shut down a bgp neighbor based on syslog entry?

 

Right now I have some IPSLA's and track statements setup, but am clueless on the EEM part. (It was so much easier in regular IOS)

 

all I want it to do is if it detects track down in syslog, it shuts the neighbor down.

 

If it detects track up, it brings the neighbor back up.

 

@xthuijsI'm hoping you see this, you seem to be a master at all things XR

7 Replies 7

balaji.bandi
Hall of Fame
Hall of Fame

I seen that script. I wouldn't even know where to start to cut out the ISIS part to make it fit my needs. I don't need to poll any data etc. I just want a if this then that script basically that says if this event shows up in syslog, shutdown this neighbor or run this command to shut down this specific neighbor.

 

We have 2 uplinks and I forsee having 4 different scripts, 2 to shut down each individual bgp neighbor, and 2 scripts to bring back online the bgp neighborship.

 

I'm not familiar enough to XR eem scripting to do this myself, that's why I was looking to see if someone had already created something similar.

 

In the old IOS EEM it was a simple EEM Applet that you could just feed in commands, XR not so much.

 

Do you have any SYSLOG message you get when the BGP go down, or you looking SYSLOG message so i can give sample EEM script

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

there are many:

RP/0/RSP0/CPU0:A9K-BNG#RP/0/RSP0/CPU0:Jun 16 19:06:38 : bgp[1083]: %ROUTING-BGP-5-ADJCHANGE : neighbor 122.1.1.1 Down - User clear requested (CEASE notification sent - administrative reset) (VRF: default) (AS: 64524)

RP/0/RSP0/CPU0:Jun 16 19:06:38 : bgp[1083]: %ROUTING-BGP-5-NSR_STATE_CHANGE : Changed state to NSR-Ready

RP/0/RSP0/CPU0:Jun 16 19:06:42 : bgp[1083]: %ROUTING-BGP-5-ADJCHANGE : neighbor 10.81.255.19 Up (VRF: default) (AS: 64530)

RP/0/RSP0/CPU0:Jun 16 19:06:42 : bgp[1083]: %ROUTING-BGP-5-NSR_STATE_CHANGE : Changed state to Not NSR-Ready

focuss on bgp routing level 5 and check the message dissect to see if you wanna act on that event or not.
xander

xthuijs
Cisco Employee
Cisco Employee

hey jason! I did! that @ stuff does work haha!

check this:

https://community.cisco.com/t5/service-providers-documents/using-embedded-event-manager-eem-in-ios-xr-for-the-asr9000-to/ta-p/3126167

this is the simple framework of converting an XR syslog to a set of config actions.

this is very similar: change the syslog to the one you want to monitor. reconfigure the actions in t he script to config what you like to do.

should be 1-2-3

cheers!

xander

It's simple if you know EEM scripting lol.

 

Just looking at that TCL for shutting down interfaces makes my eyes bleed

 

I've definitely got a lot of researching to do. I remember now why I didn't want to get into programming at a young age.

haha that's funny

in that script there is a section that executes commands, it would be copy pasting for each command oyu like:

 

if [catch {cli_write $cli1(fd) "router bgp 123"} result] {
error $result $errorInfo

 

if [catch {cli_write $cli1(fd) "neighbor 1.2.3.4"} result] {
error $result $errorInfo

 

if [catch {cli_write $cli1(fd) "shut"} result] {
error $result $errorInfo

 

other than that, the sample EEM script on that link doesnt need any modification except for the commands to be executed.

 

cheers!!

x