cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1055
Views
2
Helpful
18
Replies

EEM script for BGP

pradeep-ra
Level 1
Level 1

I need to run EMM script in router  that it will generate sys log whenever  router stop  receiving prefix from BGP peer.

please cross check below script once. 

Wool(config )# event manager trap prefix_down

 event community SNMP

 event manager applet prefix_down_applet

!

event manager applet prefix_down_applet

 event prefix down 1

 action syslog msg "BGP prefix down detected!"

event syslog pattern "BGP prefix down detected!"

 

18 Replies 18

 event routing network x.x.x.x type remove <<- check this event it use to detect ADD/Remove prefix in RIB 

MHM

Sorry didn't get you , do i need to give  below command 

 event routing network x.x.x.x type

 

 

pradeep-ra
Level 1
Level 1

event routing network x.x.x.x type remove

command not working ( as our BGP neighbor is not directly connected )

I run EEM for add prefix via BGP and action is show specific message 
in your case use same except replace the show message with the send to syslog 

MHM

Screenshot (529).png

Screenshot (531).png

Thanks for output shared by LAB screenshot 

but in my case R1 >> R2 >>R3

and i need script on R1 when prefix stop coming from R2  ( due to R2 &  R3 BGP peer issue ) 

Note R2 --R3  is real ISP BGP in my case .

In R1 if you receive prefix via bgp from R3 via R2 then you can use same coded I share but change the type from add to remove.

MHM

Hello MHM,

I created LAB with 3 router   R1, R2 and R3 (eBGP between them)

applied same EMM as shared by you on R1, but when BGP fails between R2 &R3, loopback on R3 stopped advertising on R1 but, no sys log generated on R1 for this  .

 

 login
!
event manager applet BGP
 event routing network 3.3.3.3/32 type remove protocol BGP >>>LOOPBACK on R3 router 
 action 1.0 puts "prefix are reduced due to ISP issue"
!
end

 

Are the prefix still appear in both R2 and R1

MHM

R1 has 5 prefixes received

R2 has 2 prefixes for R1 and 1 prefix for R3

R3 has 6 prefixes received

when BGP between R2 and R3 is down 

R1 4 prefix and on R2 2 prefix for R1

 

 

Sorry I talk about your lab, are the R1 and R2 still have 3.3.3.3/32 in routing table

MHM

I   created another loopback on R3 (100.100.100.100) and yes after BGP is down between R2&R3, I got alert on R1.

so, in my production environment I have to ask for the IP on ISP PE (R3 in my case) which is making BGP Peer with their CPE   .

Or can I add my Dc router IP in the script?

thanks for the help 

I check your pervious post and you need to add DC IP in script not PE ISP IP.

When DC IP remove you know that there is no more path to DC via ISP

MHM

Agree with you but problem from DC IP is, we will not sure which site has problem 

as all my 15 sites are connected to ISP MPLS and then connected to DC.

hope i am thinking correctly or you have other way out.

I see in your previous post 
branch - ISP - DC 
what you meaning of 15 sites ?

MHM

Review Cisco Networking for a $25 gift card