MEDIUM: checks: Implement postgres check using tcp-check rules
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 2 Apr 2020 09:44:39 +0000 (11:44 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Apr 2020 07:39:38 +0000 (09:39 +0200)
commitce355074f1fc76102753cc588d17e2530b4f31a0
tree619b5d7c84d9443dd6feac3019649a7f7845aa06
parentfbcc77c6baa7edee85be9c2384d12c55ef651a5a
MEDIUM: checks: Implement postgres check using tcp-check rules

A shared tcp-check ruleset is now created to support postgres check. This way no
extra memory is used if several backends use a pgsql check.

The following sequence is used :

    tcp-check connect default linger

    tcp-check send-binary PGSQL_REQ log-format

    tcp-check expect !rstring "^E" min-recv 5 \
        error-status "L7RSP" on-error "%[check.payload(6,0)]"

    tcp-check expect rbinary "^520000000800000000 min-recv "9" \
        error-status "L7STS" \
        on-success "PostgreSQL server is ok" \
        on-error "PostgreSQL unknown error"

The log-format hexa string PGSQL_REQ depends on 2 preset variables, the packet
length (check.plen) and the username (check.username).
include/proto/checks.h
include/types/checks.h
include/types/proxy.h
src/cfgparse-listen.c
src/checks.c