health check varnish

Johan Hendriks joh.hendriks at gmail.com
Thu Dec 30 08:16:46 UTC 2021


Hello all, first off all, thanks for a year full of varnish happiness 
like the developers page and the parallel ESI for the varnish-cache edition.

We use the following in the vcl for our varnish health check from our 
haproxy loadbalancers

if (req.url == "/varnish_status") {
         if (!std.healthy(req.backend_hint)) {
             return (synth(500, "Varnish: unhealthy backend."));
         }
         else {
             return (synth(200, "Varnish: All good!"));
         }
     }

And this works fine if we run varnish on the webserver itself with only 
one backend.
But if we use the director with multiple backends we get an 500 error if 
one of the backend servers is offline even if the director itself has 
enough servers left and still is marked ad healthy.

Is there a way to check if the director itself is down?

like
Backend name      Admin    Probe    Health     Last change
boot.web01        probe    5/5      healthy    Mon, 27 Dec 2021 08:42:58 GMT
boot.web02        probe    5/5      healthy    Mon, 27 Dec 2021 08:42:58 GMT
boot.web03        probe    5/5      healthy    Mon, 27 Dec 2021 08:42:58 GMT
boot.webcluster   probe    2/2      healthy    Mon, 27 Dec 2021 08:42:58 GMT

return a 200 as all is good

boot.web01        probe    2/5      sick       Wed, 29 Dec 2021 18:33:41 GMT
boot.web02        probe    4/5      healthy    Wed, 29 Dec 2021 18:33:41 GMT
boot.web03        probe    4/5      healthy    Wed, 29 Dec 2021 18:33:41 GMT
boot.webcluster   probe    1/2      healthy    Wed, 29 Dec 2021 18:33:41 GMT

still return a 200 as we still have a healthy webcluster backend.

Backend name      Admin    Probe    Health    Last change
boot.web01        probe    2/5      sick      Wed, 29 Dec 2021 18:34:40 GMT
boot.web02        probe    2/5      sick      Wed, 29 Dec 2021 18:34:40 GMT
boot.web02        probe    2/5      sick      Wed, 29 Dec 2021 18:34:40 GMT
boot.webcluster   probe    0/2      sick      Wed, 29 Dec 2021 18:34:40 GMT

return the 500 error code as our webcluster backend is down.

So can we just get the health status of webcluster in this case?


regards
Johan

And in advance a happy new year.



More information about the varnish-misc mailing list