-
Notifications
You must be signed in to change notification settings - Fork 6
Installation
First make sure that you have a working copy of Perl along with the required modules installed. See the System Requirements page for a list of required modules and installation instructions.
Install ExaBGP as usual.
For the instructions that follow below, we will be assuming that the ExaBGP configuration resides in /etc/exabgp
. If the files go in a different directory in your installation, substituate it in all relevant commands.
A sample ExaBGP configuration file is included in the repository. The BGP peer should be configured as normal in ExaBGP but a "process" should be defined for each service in the heatlcheck.pl configuration file.
As an example, if you have 2 services configured, you will need to add two process lines like this (replace service1
and service2
with your real service names):
process service1 {
run /etc/exabgp/healthcheck.pl -c announce -n service1;
}
process service2 {
run /etc/exabgp/healthcheck.pl -c announce -n service2;
}
Copy the healthcheck.pl file from the repository to /etc/exabgp
. Make sure it is executable (chmod +x /etc/exabgp/healthcheck.pl
).
Create a configuration file for the healthcheck.pl
script at /etc/exabgp/healthcheck.conf
. It is possible to install the configuration file anywhere you like, but for this installation we will keep it simple.
The configuration file is an ini style configuration, it must contain at least two sections. The first section should be the [global]
configuration - the global configuration settings will be used for all services but you can override them on a per service basis if required. The second section should be the first service you would like to create, subsequent services can be defined if required as well.
For a complete overview on the configuration options as well as samples of the configuration see the Configuration File page.
By default the script requires write access to these directories:
- /var/healthcheck - The status for services will be written to files in this directory
To change the /var/healthcheck
directory to a different location, edit healthcheck.pl
and change the value of $healthdir
.
The script will also require write access to the directory where the logs will be stored. The log file path is set per service (or globally), so ensure that it can be written to.
Run the healthcheck.pl
script with the validate option to validate the configuration file - if anything is missing it will let you know:
root@server:~# /etc/exabgp/healthcheck.pl -c validate
Validating global configuration: Valid
Validating configuration for check service1: Valid
Validating configuration for check service2: Valid
Run the healthcheck.pl
script with the announce option - this will run the script the same way ExaBGP will run it. Debug messages will be printed to the console, no routes will actually be announced. You should do this for each service defined. After it has started wait for a few seconds to let the first checks run, you should see an announcement line shortly after. As an example:
root@test:~# /etc/exabgp/healthcheck.pl -c announce -n service1
2016/05/12 14:07:09 700 DEBUG service1: Check start
2016/05/12 14:07:09 700 DEBUG service1: Attempting to fork and run check command [timeout 2 host -t soa testingresolution-$(date +%s).com 10.1.1.1 | grep -q "has no SOA record"]
2016/05/12 14:07:09 700 DEBUG service1: Executed check command [timeout 2 host -t soa testingresolution-$(date +%s).com 10.1.1.1 | grep -q "has no SOA record"]. Return code [0]
2016/05/12 14:07:09 700 INFO service1: Last check succeeded. Service needs 4 checks to succeed before it is active
2016/05/12 14:07:09 700 DEBUG service1: Check complete. Sleeping 3 seconds before next check
2016/05/12 14:07:12 700 DEBUG service1: Check start
2016/05/12 14:07:12 700 DEBUG service1: Attempting to fork and run check command [timeout 2 host -t soa testingresolution-$(date +%s).com 10.1.1.1 | grep -q "has no SOA record"]
2016/05/12 14:07:12 700 DEBUG service1: Executed check command [timeout 2 host -t soa testingresolution-$(date +%s).com 10.1.1.1| grep -q "has no SOA record"]. Return code [0]
2016/05/12 14:07:12 700 INFO service1: Last check succeeded. Service needs 3 checks to succeed before it is active
2016/05/12 14:07:12 700 DEBUG service1: Check complete. Sleeping 3 seconds before next check
...
You can now start ExaBGP. Verify that your router is receiving the BGP announcements. Everything should be working.
I recommend having a read of the CLI Usage page once everything is running.