Re: String/regex based healthcheck.

From: Willy Tarreau <>
Date: Mon, 5 May 2008 23:33:05 +0200

[cc'd Brian in case he's not subscribed]

On Tue, Apr 29, 2008 at 11:40:24PM +0200, Aleksandar Lazic wrote:
> Hi Brian,
> On Die 29.04.2008 17:36, Brandorr wrote:
> >Is there a way to check a specific "status page", for specific HTML.
> >(I see I can set the URI for httpchk). I ask because sometimes an app
> >can return proper HTML without an error code, but still be broken.
> >(Our developers setup a dynamic webpage for monitoring the application
> >stack that simply returns a web page that contains the string "OK")
> For know haproxy don't take a look in the content of the response.
> Is it possible to return a proper HTTP-Code instead the OK in the body?

I confirm it is not possible. One customer has already asked for this feature to detect anomalies in web pages. He wanted to be able to both consider a server down if one particular regex was found, as well as if a particular regex was not found.

I explained that while it would not be too hard to implement, we have to know exactly what and who we want to test. First, having a regex which applies only to the first part of the page which fits the read buffer would make sense (8 or 16 kB max), but bringing the ability to parse all of it whatever its size is another story.

Second, we have to think about combinations. I have nothing against complex checks, but we should not change them every other day, so we need either something very simple, or something extensible.

But for now, no regex and no condition :-/

An alternative to complex tests is often to dedicate a port on the server, and put a ridiculously trivial shell script which does all the work through inetd. Haproxy then monitors this port instead of the default one. It allows one to apply grep, awk, perl, whatever you need on the response and finally return 200/404/500.

Willy Received on 2008/05/05 23:33

This archive was generated by hypermail 2.2.0 : 2008/05/05 23:45 CEST