Querying backend/upstream server status

Weibin Yao nbubingo at gmail.com
Wed Jul 14 06:15:36 MSD 2010


Srebrenko Šehić at 2010-7-14 6:40 wrote:
> Hi list,
>
> I've been looking at developing a module that can provide current
> backend/upstream server status in a reverse proxy setup.
> Is there a way to query all the workers on the current upstreams
> status? I just need to know if they are "up" or "down".
>
> The idea is to be able to do something like this:
>
> worker_processes 2;
>
> http {
>
>     upstream backend_1 {
>         server 192.168.0.10:80;
>         server 192.168.0.11:80;
>     }
>
>     server {
>         server_name 127.0.0.1;
>
>         location /monitor {
>             upstream_status on;
>         }
>     }
> }
>
> Then do a curl http://127.0.0.1/monitor and get something like this back:
>
> backend_1;worker_1;192.168.0.10:80;up;
> backend_1;worker_2;192.168.0.10:80;up;
> backend_1;worker_1;192.168.0.11:80;down;
> backend_1;worker_2;192.168.0.11:80;down;
>
> Any hints?
>
> I assume this kind of information must be present somewhere in each
> worker, but I just can't seem to figure out how to get to that data.
>   
See this module as an example: 
http://github.com/cep21/healthcheck_nginx_upstreams
> Thanks,
> Srebrenko
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://nginx.org/mailman/listinfo/nginx-devel
>
>   


-- 
Weibin Yao




More information about the nginx-devel mailing list