gobetween icon indicating copy to clipboard operation
gobetween copied to clipboard

Go-between won't start with exec Health Checks

Open jrAtAustin opened this issue 5 years ago • 2 comments

I configured health checks and I am getting the following log messages and error:

gobetween v0.7.0 2020-02-10 09:32:30 [INFO ] (manager): Initializing... 2020-02-10 09:32:30 [INFO ] (server): Creating 'sample': 0.0.0.0:3000 weight static none 2020-02-10 09:32:30 [INFO ] (api): Starting up API 2020-02-10 09:32:30 [INFO ] (metrics): Metrics disabled 2020-02-10 09:32:30 [INFO ] (scheduler): Starting scheduler sample 2020-02-10 09:32:30 [INFO ] (api): Starting HTTP server :8888 2020-02-10 09:32:30 [FATAL] (manager): No bind specified

Here is my config file health check section.

## -------------------- healthchecks ------------------------- #
#
[servers.default.healthcheck]   # (optional)
kind = "exec"
interval = "2s"                 # (required) healthcheck running interval
timeout = "1s"                  # (required) max time for healthcheck to execute until mark as failed
exec_command = "/Users/me/bin/healthcheck.sh"      # (required) command to execute
exec_expected_positive_output = "1"           # (required) expected output of command in case of success
exec_expected_negative_output = "0"           # (required) expected output of command in case of failure
fails = 2                       # (optional) consecutive number of checks that should fail, to mark backend as inactive
passes = 2                      # (optional) consecutive number of checks that should pass, to mark backend as active
#
#  # -- ping -- #
#  kind = "ping"                   # Unavailable if server.protocol is udp
#
#  # -- probe -- #
#  ##
#  ## Probe sends string to backend and expects specific string in response to check if
#  ## backend is alive. Only the beginning of received buffer will be compared with expected value, so that
#  ## backend response can contain extra data, not being checked. probe_send and probe_recv are
#  ## configured as strings and support escape sequences: \n \r or \xNN for hex. First probe_recv_len bytes of server response 
#  ## could be also matched using regular expression.
#  ##
#  kind = "probe"
#  probe_protocol = "udp"         # (required) "udp" | "tcp"
#  probe_strategy = "starts_with" # (optional) "starts_with" | "regexp"
#  probe_send    = 'PING\xFF\n'   # (required) string to send
#  probe_recv    = 'PONG\xAA\n'   # (required) string to expect in response (response starts with or regexp)
#  probe_recv_len = 0             # (optional) number of bytes to read (value > 0 is required for regexp strategy)
#
#  # -- exec -- #
#kind = "exec"
#exec_command = "/Users/me/bin/healthcheck.sh"      # (required) command to execute
#exec_expected_positive_output = "1"           # (required) expected output of command in case of success
#exec_expected_negative_output = "0"           # (required) expected output of command in case of failure
#
## -------------------- discovery ---------------------------- #>

Here is my health check script:

#!/bin/bash
nc -z $1 $2

if [ $? -eq 0 ]
then
	echo -n 1 ;
else
	echo -n 0 ;
fi

Without health check configured go-between functions fine. I am running on Mac OS Catalina 10.15.3.

jrAtAustin avatar Feb 10 '20 15:02 jrAtAustin

Hello, @jrAtAustin Could you please format your config with code formatting, currently it's unreadable and it's hard to understand it and help you.

yyyar avatar Feb 12 '20 07:02 yyyar

Yaroslav, I formatted the config as requested. Thanks for looking into my issue.

On Wed, Feb 12, 2020 at 1:10 AM Yaroslav Pogrebnyak < [email protected]> wrote:

Hello, @jrAtAustin https://github.com/jrAtAustin Could you please format your config with code formatting, currently it's unreadable and it's hard to understand it and help you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yyyar/gobetween/issues/268?email_source=notifications&email_token=AAB5A74LYPDLID365NOGZ7DRCOOF3A5CNFSM4KSQNCW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELPVXHQ#issuecomment-585063326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB5A73VZ5YX46DAYVT3YELRCOOF3ANCNFSM4KSQNCWQ .

jrAtAustin avatar Feb 12 '20 23:02 jrAtAustin