Announcing the upstream status module

Maxim Dounin mdounin at mdounin.ru
Wed Apr 14 00:25:56 MSD 2010


Hello!

On Tue, Apr 13, 2010 at 11:26:04PM +0530, Arvind Jayaprakash wrote:

> On Apr 12, Maxim Dounin wrote:
> >Hello!
> >
> >On Mon, Apr 12, 2010 at 10:18:33PM +0530, Arvind Jayaprakash wrote:
> >
> >> This module provides a handler called upstream_status that can be used
> >> as follows:
> >> 
> >> location /foo {
> >> 	  upstream_status;
> >> }
> >> 
> >> 
> >> It reports all the upstream blocks configured for this server. For
> >> upstreams managed using the round robin (default upstream), it lists all
> >> the backends configured in a block and indicates the current status
> >> (up/down)
> >> 
> >> http://github.com/anomalizer/ngx_upstream_status
> >> 
> >> 
> >> Improvements are welcome.
> >
> >Most important improvement is to document that it actually shows 
> >configuration and status of upstreams in one particular worker 
> >process which status request happened to hit.
> 
> Done. I did not realize this until pointed it out but it now seems
> obvious.
> 
> >And, uhm, number of allocs you use to produce simple answer is 
> >really outstanding.  ;)
> 
> I completely hated it during the development. If there is an equivalent
> of asprinf() in the nginx API, or a better way, do let me know.

Usual aproach is to count needed buffer size, allocate buffer, and 
then print.  See stub status module for an example.

Maxim Dounin



More information about the nginx mailing list