Skip to content

Instantly share code, notes, and snippets.

@elico
Created June 26, 2019 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elico/db3d2e4c63989f0326db60c15dc92206 to your computer and use it in GitHub Desktop.
Save elico/db3d2e4c63989f0326db60c15dc92206 to your computer and use it in GitHub Desktop.
ExaBGP monitor squid and announce
#!/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
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