External-check command is not working with MySQL servers


#1

Trying to use the external-check settings and it does not seem to work at all. Servers are permanently marked down.

Config that is using mysql-check works fine:
` global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
external-check
debug

defaults
    log global
    retries 2
    timeout connect 3000
    timeout server 5000
    timeout client 5000

frontend mysql-cluster
    bind 0.0.0.0:3306
    default_backend servers

backend servers
    log global
    mode tcp
    option mysql-check
    #option external-check
    #external-check command /bin/true
    #external-check path "/usr/bin:/bin"
    option tcplog
    balance roundrobin
    option log-health-checks
    server mysql-1 aurora-test-1.cgqagbohyssb.us-east-1.rds.amazonaws.com:3306 check
    server mysql-2 aurora-test-2.cgqagbohyssb.us-east-1.rds.amazonaws.com:3306 check

# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt,qtime,ctime,rtime,ttime,
mysql-cluster,FRONTEND,0,0,2000,0,0,0,0,0,0,OPEN,1,2,0,0,0,0,0,0,0,0,0,0,0,0,
servers,mysql-1,0,0,0,0,0,0,0,0,0,0,0,0,UP,1,1,0,0,0,461,0,1,3,1,0,2,0,0,L7OK,0,3,0,0,0,-1,5.6.10,0,0,0,0,
servers,mysql-2,0,0,0,0,0,0,0,0,0,0,0,0,UP,1,1,0,0,0,461,0,1,3,2,0,2,0,0,L7OK,0,1,0,0,0,-1,5.6.10,0,0,0,0,
servers,BACKEND,0,0,0,0,200,0,0,0,0,0,0,0,0,0,UP,2,2,0,0,461,0,1,3,0,0,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,
`

Same exact config with external-check always shows servers down:
` global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
external-check
debug

defaults
    log global
    retries 2
    timeout connect 3000
    timeout server 5000
    timeout client 5000

frontend mysql-cluster
    bind 0.0.0.0:3306
    default_backend servers

backend servers
    log global
    mode tcp
    #option mysql-check
    option external-check
    external-check command /bin/true
    external-check path "/usr/bin:/bin"
    option tcplog
    balance roundrobin
    option log-health-checks
    server mysql-1 aurora-test-1.cgqagbohyssb.us-east-1.rds.amazonaws.com:3306 check
    server mysql-2 aurora-test-2.cgqagbohyssb.us-east-1.rds.amazonaws.com:3306 check

# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt,qtime,ctime,rtime,ttime,
mysql-cluster,FRONTEND,0,0,2000,0,0,0,0,0,0,OPEN,1,2,0,0,0,0,0,0,0,0,0,0,0,0,
servers,mysql-1,0,0,0,0,0,0,0,0,0,0,0,0,DOWN,1,1,0,1,1,3,3,1,3,1,0,2,0,0,PROCERR,255,0,0,0,0,-1,0,0,0,0,
servers,mysql-2,0,0,0,0,0,0,0,0,0,0,0,0,DOWN,1,1,0,1,1,2,2,1,3,2,0,2,0,0,PROCERR,255,0,0,0,0,-1,0,0,0,0,
servers,BACKEND,0,0,0,0,200,0,0,0,0,0,0,0,0,0,DOWN,0,0,0,1,2,2,1,3,0,0,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,

`

What is the correct way to specify the external checks for mysql servers? Optimal would be to be able to run mysql-check and then external-check script.


#2

Just to answer my own question - the external check does not work with chroot. Do not specify chroot in global session.


#3

Or create a chroot with all the binaries and libraries required by your checkā€¦