Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

CLI Usage

shthead edited this page May 12, 2016 · 2 revisions

Introduction

The healthcheck.pl script lets you run various commands to check the status of services being advertised, validate the configuration file and more.

The list of commands available can be found by passing the argument -help to the healthcheck.pl script:

/etc/exabgp/healthcheck.pl -help

Most commands can be executed with or without specifying a service - if you do not specify a service name the command will apply to all services defined in the configuration file.

The current commands that can be passed to the script are:

    Arguments:

      -command [command]  | -c [command]  The command to run. See the above commands for a list.
      -name [name]        | -n [name]     The name of the service to check. Must be present as a section in the configuration file.
                                          This argument is REQUIRED for the 'announce' command.
      -config [path]      | -f [path]     The path to the configuration file. Defaults to /etc/exabgp/healthcheck.conf.
      -help               | -h            Print this help message and exit.
      -version            | -v            Print the version and exit.

    Commands:

      announce          Run checks and announce services.
      validate          Validate the configuration file and exit.
      status            Check the status and exit.
      list [Default]    List the details for a check/all checks and exit.

If no command is specified the default action is to parse the configuration file and list the details for all checks then exit.

Announce

To run the script the same way ExaBGP will to announce routes, call the script with -c announce -n [service name]. This command REQUIRES a service name be provided.

This is useful when adding new services and debugging services - debug output will automatically be turned on when running this from the console, all debugging output will be sent to the console (not the log file).

Running this command will not actually announce any routes, so it is safe to do this at any time.

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 /bin/true]
2016/05/12 14:07:09 700 DEBUG service1: Executed check command [timeout 2 /bin/true]. 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
....

Validate

To validate the healthcheck.pl configuration file, call the script with -c validate. If you only want to validate a specific configuration use -c validate -n [service name]:

root@server:~# /etc/exabgp/healthcheck.pl -c validate
Validating configuration for check service1: Valid
Validating configuration for check service2: Valid
root@server:~# /etc/exabgp/healthcheck.pl -c validate -n service1
Validating configuration for check service1: Valid
root@server:~#

Status

The status command will show you the status of all services or a single service. Call the script with -c status for all services or -c status -n [service name]. As an example:

root@test:~# /etc/exabgp/healthcheck.pl -c status
STATUS FOR service1:
Service State: UP
Last State Change: 2016-05-10 21:15:10
Nexthop: 192.168.1.1
Managed IP's: 10.1.1.1/32

STATUS FOR service2:
Service State: UP
Last State Change: 2016-05-10 21:15:10
Nexthop: 192.168.1.1
Managed IP's: 10.1.1.2/32

root@test:~# /etc/exabgp/healthcheck.pl -c status -n service1
STATUS FOR service1:
Service State: UP
Last State Change: 2016-05-10 21:15:10
Nexthop: 192.168.1.1
Managed IP's: 10.1.1.1/32

root@test:~#

List

The list command will list the details for all services or a single service. Call the script with -c list for all services or -c list -n service1. As an example:

root@test:~# /etc/exabgp/healthcheck.pl -c list -n service1
Facts for service1:
 - Service Name: service1
 - Check Command: "/bin/true"
 - Check Interval: 3
 - Check Timeout: 2
 - Disable File: /etc/exabgp/healthcheck_service1.disable
 - Service Rise: 5
 - Service Fall: 3
 - Service Log: /var/log/healthcheck/healthcheck
 - Debug Log: no
 - Log Check Output: no
 - Route Metric: 100
 - Route Nexthop: 192.168.1.1
 - Announce IP's:
   - 10.1.1.1/32
Clone this wiki locally