Feature request: Run a script when upstream detected down/up

Aleksandar Lazic al-nginx at none.at
Wed Apr 30 01:36:58 MSD 2008


On Die 29.04.2008 21:27, François Battail wrote:
>Rt Ibmer <rtibmx at ...> writes:
>
>> >> if (fork() == 0)
>> >  > execl("/bin/sh","/path/to/upstream_down.sh","ID of down upsteam 
>> >>goes here", NULL);
>> 
>> >It's not as easy to do.
>> 
>> At a high level, what am I missing / oversimplifying?
>
>The problem is not at high level but at low level: you cannot put code
>like this on a server, it's not a matter of writing two lines but to
>test potential errors, to have clean configuration parameters and to
>maintain the software...

[snipp]

>> Perfect! I just need the hook.
>
>Some input from the list will be appreciated, I believe that such a
>module will add value to Nginx but some time is needed in order to
>fully evaluate the implications and the best implementation.

I think for this the embedded script language
(perl/neko/lua/python/your_preferd_lang;-) will be very helpfull :-)


Brainstorming:

1.) add hook into upstream module, maybe some other modules also ;-)
2.) use this hook in $EMBEDDED_SCRIPT (current only perl) to write into
     $OUTPUT_THING (file/shm/...) 
3.) use external program which monitor the $OUTPUT_THING

The benefit to use a embedded script language is that the user can write
some infos into the output string and some predefined variables from
nginx.

I know this is a lot of work but it could be a 100% solution ;-)

Cheers

Aleks





More information about the nginx mailing list