Haproxy http response timeout check

haproxyhealthcheckresponse-time

We use haproxy as http load balancer. Sometimes one of our servers stop responding while accepting http connection requests. So stats page displays servers as green "accessible" but our nagios server says "CRITICAL – Socket timeout after 20 seconds" and that server is not responding actually.

How to tell haproxy to check page response time and if it takes longer than timeout then tag it as DOWN.

Best Answer

You need to have health checks in place https://www.haproxy.com/doc/aloha/7.0/haproxy/healthchecks.html. You specifically need check_timeouts "timeout check : time let to the server to answer the check. If both inter and timeout check are set, then the smallest value of both of them is used, after the TCP connection is established"