Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

healthchecker for BIRD-anycasted services

NotificationsYou must be signed in to change notification settings

skoef/birdwatcher

Repository files navigation

Go Report Card

healthchecker forBIRD-anycasted services

⚠️NOTE: this version of birdwatcher is designed to work with BIRD version 2 and up. If you want to use birdwatcher with BIRD 1.x, refer to thebird1 branch.

This project is heavily influenced byanycast-healthchecker. If you want to know more about use cases of birdwatcher, please read their excellent documention about anycasted services and how a healthchecker can contribute to a more stable service availability.

In a nutshell: birdwatcher periodically checks a specific service and tells BIRD which prefixes to announce or to withdraw when the service appears to be up or down respectively.

Why birdwatcher

When I found out about anycast-healthchecker (sadly only recently onHaproxyConf 2019), I figured this would solve the missing link between BIRD and whatever anycasted services I have running (mostly haproxy though). Currently however in anycast-healthchecker, it is not possible to specify multiple prefixes to a service. Some machines in these kind of setups are announcingmany/32 and/128 prefixes and I ended up specifiying so many services (one per prefix) that python crashed giving me atoo many open files error. At first I tried to patch anycast-healthchecker but ended up writing something similar, hence birdwatcher.

It is written in Go because I like it and running multiple threads is easy.

Upgrading

Upgrading from 1.0.0-beta2 to 1.0.0-beta3

The notation oftimeout for services changed from int (for number of seconds) to the formattime.ParseDuration uses, such as "300ms", "-1.5h" or "2h45m".

For example:10 should become"10s" in your config files.

Example usage

This simple example configures a single service, runshaproxy_check.sh every second and manages 2 prefixes based on the exit code of the script:

[services]  [services."foo"]command ="/usr/bin/haproxy_check.sh"prefixes = ["192.168.0.0/24","fc00::/7"]

Sample output in/etc/bird/birdwatcher.conf ifhaproxy_check.sh checks out would be:

# DO NOT EDIT MANUALLYfunction match_route() -> bool{return net ~ [192.168.0.0/24,fc00::/7];}

As soon as birdwatcher finds out haproxy is down, it will change the content in/etc/bird/birdwatcher.conf to:

# DO NOT EDIT MANUALLYfunction match_route() -> bool{return false;}

and reconfigures BIRD by givenreloadcommand. Obviously, if you have multiple services being checked by birdwatcher, only the prefixes of that particular service would be removed from the list inmatch_route.

Integration in BIRD is a matter of including/etc/bird/birdwatcher.conf (or whatever you configured atconfigfile) in the configuration for BIRD and use it in a protocol like this:

protocol bgp my_bgp_proto {  local as 12345;  neighbor 1.2.3.4 as 23435;  ...  ipv4 {    ...    export where match_route();  }  ...  ipv6 {    ...    export where match_route();  }}

Configuration

global

Configuration section for global options.

keydescription
configfilePath to configuration file that will be generated and should be included in the BIRD configuration. Defaults to/etc/bird/birdwatcher.conf.
reloadcommandCommand to invoke to signal BIRD the configuration should be reloaded. Defaults to/usr/sbin/birdc configure.
compatbird213To use birdwatcher with BIRD 2.13 or earlier, enable this flag. It will remove the function return types from the output

[services]

Each service under this section can have the following settings:

keydescription
commandCommand that will be periodically run to check if the service should be considered up or down. The result is based on the exit code: a non-zero exit codes makes birdwatcher decide the service is down, otherwise it's up.Required
functionnameSpecify the name of the function birdwatcher will generate. You can use this function name to use in your protocol export filter in BIRD. Defaults tomatch_route.
intervalThe interval in seconds at which birdwatcher will check the service. Defaults to1
timeoutTime in which the check command should complete. Afterwards it will be handled as if the check command failed. Defaults to10s, format following that oftime.ParseDuration.
failThe amount of times the check command should fail before the service is considered to be down. Defaults to1
riseThe amount of times the check command should succeed before the service is considered to be up. Defaults to1
prefixesArray of prefixes, mixed IPv4 and IPv6. At least 1 prefix isrequired per service

[prometheus]

Configuration for the prometheus exporter

keydescription
enabledBoolean whether you want to export prometheus metrics. Defaults tofalse
portPort to export prometheus metrics on. Defaults to9091
pathPath to the prometheus metrics. Defaults to/metrics

About

healthchecker for BIRD-anycasted services

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp