Linux – Nginx upstream health check modules


Is anyone using any health check modules on nginx.

What we need is a simple health checker that would ping the backend nodes and would stop sending traffic to one of them if it doesnt respond to the health check.

I found this –

But then trying to getting this to compile for centos has been extremely difficult.

Let me know if you have been able to successfully setup this on linux or have any other ideas as to whether I should use another alternative health check module.


[root@SOMESERVER nginx-1.6.1]# patch -p1 < /tmp/healthchecknginx/nginx_upstream_check_module-0.1.9/check_1.2.6+.patch

1 out of 8 hunks FAILED -- saving rejects to file src/http/ngx_http_upstream_round_robin.c.rej
patching file src/http/ngx_http_upstream_round_robin.h

— ERROR 2–

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

Best Solution

I was looking for a simple health check as Amazon ELB provides. Ability to add instances to a load balancer and have a health check mechanism to remove faulty instances.

So here were my options.



  3. Nginx also provides a passive health check for free. It does exactly what I want it to, no fancy monitoring, no weights, no fancy route check. It would ping the server and check for 200 status response. It would do it in round-robin fashion.

    The fail_timeout parameter sets the time during which the specified number of failed attempts should happen and still consider the server unavailable. In other words, the server is unavailable for the interval set by fail_timeout.

    The max_fails parameter sets the number of failed attempts that should happen during the specified time to still consider the server unavailable.


    upstream search {
        server max_fails=3 fail_timeout=10s;
        server max_fails=3 fail_timeout=10s;