-
Notifications
You must be signed in to change notification settings - Fork 6
Configuration File
The configuration file is an ini style plain text file. There must be at least two sections, a [global]
section for default values and a section for each service that you would like to check and announce for.
The settings in the [global]
section can also be specified per service - if you have 10 checks and the [global]
section contains the line metric=10
all routes will be advertised with a MED of 10. If in one of the services you add metric=20
that specific service will be advertised with a higher metric than the others.
Note that any changes made to the configuration file will automatically be applied once it has been saved - you do not need to reload/restart any services, it is all automatic. When you make a change to the config it is validated first, if the validation does not pass it will not be reloaded.
These options can all be set in the [global]
section, the service checks will then inherit these options. All options set in the [global]
section can be set on a per service basis.
[global]
# The interval determins how often health checks are ran (in seconds).
# An interval of 3 will wait 3 seconds between each health check.
interval=3
# Wait N seconds for the check command to execute. The timeout must be
# lower than the interval. If the timeout is reached the service is assumed
# down and the process of withdrawing the route begins.
timeout=2
# The MED of all routes being announced. Must be between 1 and 1000.
metric=100
# How many times the service check must pass before the service is considered
# up. If this is set to 5, the service must pass 5 health checks before the
# route will be announced.
rise=5
# How many times the service check must fail before the service is considered
# down. If this is set to 5, the service must fail 5 health checks before the
# route will be withdrawn.
fall=3
# Log location. This must be a full path to a file. If the file does not exist
# it will be created (if the permissions allow it). If the file cannot be
# created the script will error and exit. Errors will be logged to
# [filename].err and debug to [filename].debug (if enabled).
logfile=/var/log/healthcheck/healthcheck
# Log the output of the check command to the debug log. Requires debug=yes
logcheck=no
# Enable the debug log
debug=no
The following options are set per service and are required, these are the bare minimum configuration options you can set for each service. You can also set any of the [global]
values if required.
[servicename]
# The next hop IP address for the route to be advertised with BGP. This will
# usually be the servers main IP address. This IP must belong to the same
# address family as the IP's being announced.
nexthop=192.168.1.1
# The command to use for health check. This can be anything you like - a bash
# one liner or a script etc. The command that is executed MUST have an exit
# code of 0 for success. Any other exit code is considered fail.
command="/bin/true"
# IP addresses to announce. You can specify as many as you like. Ensure that
# the IP addresses all belong to the same address family as the nexthop IP.
# If you do not specify a mask for the IP address it is assumed to be /128 for
# IPv6 and /32 for IPv4.
ip=10.1.1.1/32
ip=10.1.1.1/32
# If this file exists the service will be considered down. You can use this to
# disable the service easily - simple touch the file and the routes will be
# withdrawn. Once you are done, remove the file and the service will start
# being checked again.
disable=/etc/exabgp/healthcheck_servicename.disable
For this example, we will create a service named servicev4
which will advertise the IPv4 address 10.1.1.1/32 and 10.1.1.2/32. A second service will be named servicev6
which will advertise the IPv6 address fd12:3456:ffff:1::1/128. The server running ExaBGP has the IPv4 address 192.168.1.1 and the IPv6 address 2001:0DB8::1.
[global]
interval=3
timeout=2
metric=100
rise=5
fall=3
logfile=/var/log/healthcheck/healthcheck
logcheck=no
debug=no
[ipv4]
nexthop=192.168.1.1
command="/scripts/check_dns_status"
ip=10.1.1.1
ip=10.1.1.2
disable=/etc/exabgp/healthcheck_ipv4.disable
[ipv6]
nexthop=2001:0DB8::1
command="/scripts/check_dns_status"
ip=fd12:3456:ffff:1::1
disable=/etc/exabgp/healthcheck_ipv6.disable