Created
June 26, 2019 02:46
-
-
Save elico/db3d2e4c63989f0326db60c15dc92206 to your computer and use it in GitHub Desktop.
ExaBGP monitor squid and announce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
STATE="start" | |
while true; do | |
ls /etc/exabgp/squid-up >/dev/null 2>&1 | |
RES=$? | |
if [[ "${RES}" -eq "0" ]]; then | |
if [[ "${STATE}" != "up" ]]; then | |
echo "announce watchdog squid" | |
STATE="up" | |
fi | |
else | |
if [[ "${STATE}" != "down" ]]; then | |
echo "withdraw watchdog squid" | |
STATE="down" | |
fi | |
fi | |
sleep 2 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process watch-application { | |
run bash /etc/exabgp/check-squid.sh; | |
encoder text; | |
} | |
neighbor 10.0.55.254 { | |
description "will announce a route to a service"; | |
router-id 10.0.55.1; | |
local-address 10.0.55.1; | |
local-as 65511; | |
peer-as 65511; | |
md5-password test_password; | |
hold-time 180; | |
family { | |
ipv4 unicast; | |
} | |
api services { | |
processes [ watch-application ]; | |
} | |
static { | |
route 10.1.55.1/32 { | |
next-hop self; | |
watchdog squid; | |
local-preference 100; | |
med 100; | |
} | |
route 10.1.55.2/32 { | |
next-hop self; | |
watchdog squid; | |
local-preference 400; | |
med 400; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment