!!create a variable to get BGP Status !!Since we look for each neighbor if BGP up or Down messages event manager enviroment BGP 0 !!Neighbor 1 !!IF BGP neighbor is down. Verify if other neighbor is UP or DOWN and do action. event manager applet BGP_DOWN_1 event syslog pattern "neighbor IPaddress1 Down" action 02 if $BGP eq 0 action 50 syslog msg "Setting variable equals 20 - 1 links down" action 51 set $BGP 20 action 55 exit action 60 if $BGP ne 0 action 61 syslog msg "Shuting down interfaces for neighbor - 2 neighbors down" action 62 set $BGP 40 action 63 cli command "enable" action 64 cli command "conf term" action 65 cli command "interface vlan 30" action 66 cli command "shutdown" action 67 cli command "interface vlan 31" action 68 cli command "shutdown" action 69 syslog msg "Removed comunications with Router Reflector" action 70 exit !!Neighbor 1 !!IF BGP neighbor is online again event manager applet BGP_UP_1 event syslog pattern "neighbor IPaddress1 Up" action 02 if $BGP eq 20 action 50 puts "Reseting variable" action 51 set $BGP 0 action 55 exit action 60 if $BGP eq 40 action 61 syslog msg "Activating interfaces" action 62 cli command "enable" action 63 cli command "conf term" action 65 cli command "interface vlan 30" action 66 cli command "no shutdown" action 67 cli command "interface vlan 31" action 68 cli command "no shutdown" action 69 exit !!!Neighbor 2 !!BGP down event manager applet BGP_DOWN_2 event syslog pattern "neighbor IPaddress2 Down" action 02 if $BGP eq 0 action 50 syslog msg "Setting variable equals 20 - 1 neighbor down" action 51 set $BGP 20 action 55 end action 60 if $BGP ne 0 action 60 syslog msg "Shuting down interfaces for neighbor - 2 links down" action 61 set $BGP 40 action 62 cli command "enable" action 63 cli command "conf term" action 65 cli command "interface vlan 30" action 66 cli command "shutdown" action 67 cli command "interface vlan 31" action 68 cli command "shutdown" action 69 syslog msg "Removed comunications with Router Reflector" action 70 end !!IF BGP Neighbor is up. event manager applet BGP_UP_2 event syslog pattern "neighbor IPaddress2 Up" action 02 if $BGP eq 20 goto 50 action 03 if $BGP eq 40 goto 100 action 50 puts "Reseting variable" action 51 set $BGP 0 action 55 exit action 100 syslog msg ""Activating interfaces" action 102 cli command "enable" action 103 cli command "conf term" action 105 cli command "interface vlan 30" action 106 cli command "no shutdown" action 105 cli command "interface vlan 31" action 106 cli command "no shutdown" action 105 exit