3

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 - https://github.com/cep21/healthcheck_nginx_upstreams

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.

--ERROR 1--

[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.

3 Answers 3

7

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.

  1. https://github.com/yaoweibin/nginx_upstream_check_module

  2. https://github.com/openresty/lua-resty-upstream-healthcheck

  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.

    Eg:

    upstream search {
        server 192.168.215.43:9200 max_fails=3 fail_timeout=10s;
        server 192.168.171.66:9200 max_fails=3 fail_timeout=10s;
    }

Source

2
1

There has been a fork of upstream check module with updates for 1.5.12+ and 1.7+

https://github.com/yaoweibin/nginx_upstream_check_module

0

You might not want to spend money on this, but it's worth pointing out that NGINX's premium version features health checks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.