06-16-2021 10:02 AM
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
06-16-2021 10:17 AM
Look at the below document may help you on XR :
06-16-2021 10:39 AM
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.
06-16-2021 12:59 PM
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
06-16-2021 03:50 PM
06-16-2021 12:16 PM
hey jason! I did! that @ stuff does work haha!
check this:
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
06-21-2021 03:23 PM
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.
06-22-2021 05:06 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide