githubEdit

EEM

Failover

event manager applet FAILOVER_TO_AKAMAI
 event track 1 state down
 action 1.0 syslog msg "Cloudflare SLA down – initiating Akamai advertisement"

 ! Step 1: Advertise to Akamai
 action 2.0 cli command "enable"
 action 3.0 cli command "configure terminal"
 action 4.0 cli command "router bgp 1"
 action 5.0 cli command "neighbor 13.0.0.2 route-map RM_OUT-AK out"
 action 6.0 cli command "neighbor 14.0.0.2 route-map RM_OUT-AK out"
 action 7.0 cli command "end"

 ! Step 2: Wait before verification
 action 8.0 wait 30
 action 8.1 syslog msg "Waited 30 seconds – checking Akamai advertisement"

 ! Step 3: Verify advertisement to Akamai
 action 9.0 cli command "show ip bgp neighbors 13.0.0.2 advertised-routes | include 150.0.0.0"
 action 9.1 regexp "150.0.0.0" "$_cli_result" result

 ! Step 4: Conditional withdrawal from Cloudflare
 action 10.0 if $result eq "1"
 action 10.1  syslog msg "Confirmed 150.0.0.0/24 advertised to Akamai – withdrawing from Cloudflare"
 action 10.2  cli command "enable"
 action 10.3  cli command "configure terminal"
 action 10.4  cli command "router bgp 1"
 action 10.5  cli command "no neighbor 11.0.0.2 route-map RM_OUT-CF out"
 action 10.6  cli command "no neighbor 12.0.0.2 route-map RM_OUT-CF out"
 action 10.7  cli command "end"
 action 10.8 end

Fail back

Python Script

EEM failover

Fail back

API

  • https://techdocs.akamai.com/prolexic/reference/post-routed-bgp-sessions

  • https://developers.cloudflare.com/api/resources/radar/subresources/bgp/subresources/ips/methods/timeseries/

Python script to query API

EEM

Python script to query Akamai

Python Script to Query BGP Tools

EEM

Debug

  • debug event manager all: debug to see error during runtime

Other EEM Notification

SNMP Trap

Email

Message to team

EEM to team via python script

Last updated