11-16-2023 08:10 PM - edited 01-28-2024 11:15 AM
11-16-2023 11:00 PM
event routing network x.x.x.x/y type add protocol BGP
try this event to detect add of prefix in your table
11-17-2023 02:01 AM
Are you looking to check the Prefix in routing table then alert using email ?
check below example help you to build one and test it :
11-18-2023 06:50 AM
Hello @tinhnho123
Embedded Event Manager (EEM) script on a Cisco router to track/monitor the prefixes 10.19.99.0/24 and 10.20.100.0/24 and trigger an action if either or both disappear from the routing table, you can use the following EEM script:
event manager applet MonitorBgpPrefixes
event timer watchdog time 1800 maxrun 1790
action 1.0 syslog msg "Checking for the presence of prefixes in the BGP routing table..."
action 2.0 cli command "show ip route bgp | include 10.19.99.0/24"
action 3.0 regexp "10\.19\.99\.0" $_cli_result
action 4.0 set result1 "$_regexp_result"
action 5.0 cli command "show ip route bgp | include 10.20.100.0/24"
action 6.0 regexp "10\.20\.100\.0" $_cli_result
action 7.0 set result2 "$_regexp_result"
action 8.0 if $result1 eq "0" || $result2 eq "0"
action 8.1 syslog msg "One or both prefixes (10.19.99.0/24 and/or 10.20.100.0/24) are missing from the BGP routing table!"
action 8.2 syslog msg "Taking corrective action..."
action 8.3 cli command "your corrective action here" ;# Replace with your corrective action
action 8.4 end
In this script, the event timer watchdog is used to trigger the script at regular intervals (every 1800 seconds or 30 minutes, you can adjust it as needed). The script then checks for the presence of the specified prefixes in the BGP routing table using regular expressions. If either or both prefixes are not found, it logs a syslog message and takes a corrective action.
12-08-2023 08:22 AM
Hello
When I entered this below and got the invalid input error:
ISR4451(config-applet)#action 8.0 if $result1 eq "0" || $result2 eq "0"
^
% Invalid input detected at '^' marker.
ISR4451(config-applet)#
======
And below is the out put question marks.
ISR4451(config-applet)#action 8.0 if $result1 eq "0"?
WORD
ISR4451(config-applet)#action 8.0 if $result1 eq "0" ?
goto goto label
<cr> <cr>
ISR4451(config-applet)#action 8.0 if $result1 eq "0"
It doesn't support '||'; what do we need to replace it with?
I have SMTP server, how do we tell the script to email when one or two prefixes are missing?
Thanks.
12-08-2023 08:25 AM
Action for what ?!?
You need event to detect add remove prefix from RIB then use action to send emails or syslog.
MHM
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