nginx how to get status of webservers on the backend?
HAProxy has a very nice status page showing me which webservers are up and which ones are down on the backend. I am trying to debug some issues and need to know which servers nginx thinks are up and which ones it thinks are down. Is there a web page or something that you can configure for nginx so I can just hit a url when I need this type of information?
thanks, Dean
Solution 1:
There are a couple of modules you may want to check out:
- https://github.com/anomalizer/ngx_upstream_status (displays status as seen by the worker serving the status page)
- https://github.com/yaoweibin/nginx_upstream_check_module (proactively checks status of upstream servers)
- https://github.com/cep21/healthcheck_nginx_upstreams (similar to the previous one but only supports HTTP 1.0 for status checks)
- http://nginx.localdomain.pl/wiki/UpstreamFair (load balancer with built-in status page)
- ...
Solution 2:
Unfortunately this is almost impossible out of the box. vanila nginx has not global state for upstream by design so this information is local for every worker process.
Take a look at this module seems may be useful for you http://wiki.nginx.org/NginxHttpHealthcheckModule