Grretings. I’ll greatly appreciate some help with script as my scripting and programming skills are below zero.
I need bgp peer which “name” ends with “asr1” to be disable at site-A-router if icmp packet loss to WAN ip address at site-B-router is above 5%.
I tried to figure this out myself and ended up with script below, but it does not work
# VARIABLES
:local asr1 "212.2.33.84";
:local pingCount 20;
:local stableConnectionFrom 95;
:local quality ([/ping count=$pingCount $asr1] * 100 / $pingCount)
# Connection quality check and bgp peers disable or enable
:if ($quality < $stableConnectionFrom) do={
/routing bgp peer disable [find where name~"asr1" and disabled=no]
}
elese={
do={/routing bgp peer enable [find where name~"asr1" and disabled=yes]
}
}
Post it in Code tags and tabs, makes it easier to read.
PS I have not tested it.
fixed: elese-else
removed extra: }
removed: do
removed not needed ; at end of lines
# VARIABLES
:local asr1 "212.2.33.84"
:local pingCount 20
:local stableConnectionFrom 95
:local quality ([/ping count=$pingCount $asr1] * 100 / $pingCount)
# Connection quality check and bgp peers disable or enable
:if ($quality < $stableConnectionFrom) do={
/routing bgp peer disable [find where name~"asr1" and disabled=no]
} else={
/routing bgp peer enable [find where name~"asr1" and disabled=yes]
}