Querying backend/upstream server status

Srebrenko Šehić ssehic at gmail.com
Wed Jul 14 02:40:21 MSD 2010


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.

Thanks,
Srebrenko



More information about the nginx-devel mailing list