I have created an external healthcheck within a bash script but the server doesn’t come up… I know it works as it will return ‘200’ when I run it manually:
RESP=$(curl -s -o /dev/null -w “%{http_code}” --ntlm -H ‘Host: ‘${CHECK_HOST}’’ http://${SERVERIP}/ -u ${USER}:${PASSWD})
echo $RESP
if [ $RESP == 200 ]
then
Server is Healthy.
exit 0
else
Server is NOT Healthy.
exit 1
fi
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
external-check
listen stats
bind 0.0.0.0:4444
mode http
stats uri /
frontend http_testfront
bind 0.0.0.0:9090
mode http
default_backend script_test
backend script_test
mode http
option external-check
external-check path “/var/lib/haproxy”
external-check command /var/lib/haproxy/healthcheck.sh
server server1 1.1.1.1:80 check