

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
27 messages in ru.sysoev.nginxRe: Feature request: Run a script whe...| From | Sent On | Attachments |
|---|---|---|
| Rt Ibmer | Apr 28, 2008 8:44 am | |
| Cliff Wells | Apr 28, 2008 10:20 am | |
| mike | Apr 28, 2008 11:53 am | |
| Rt Ibmer | Apr 28, 2008 2:02 pm | |
| Cliff Wells | Apr 28, 2008 2:18 pm | |
| Manlio Perillo | Apr 28, 2008 2:37 pm | |
| Rt Ibmer | Apr 28, 2008 6:10 pm | |
| Rt Ibmer | Apr 28, 2008 6:19 pm | |
| Manlio Perillo | Apr 29, 2008 1:18 am | |
| Manlio Perillo | Apr 29, 2008 1:25 am | |
| Rt Ibmer | Apr 29, 2008 8:11 am | |
| François Battail | Apr 29, 2008 10:46 am | |
| Rt Ibmer | Apr 29, 2008 1:41 pm | |
| Manlio Perillo | Apr 29, 2008 1:57 pm | |
| François Battail | Apr 29, 2008 2:27 pm | |
| Aleksandar Lazic | Apr 29, 2008 2:36 pm | |
| François Battail | Apr 29, 2008 11:20 pm | |
| Mansoor Peerbhoy | Apr 30, 2008 1:46 am | |
| Manlio Perillo | Apr 30, 2008 2:36 am | |
| François Battail | Apr 30, 2008 3:54 am | |
| Mansoor Peerbhoy | Apr 30, 2008 5:03 am | |
| Grzegorz Nosek | Apr 30, 2008 5:18 am | |
| Cliff Wells | Apr 30, 2008 10:40 am | |
| Manlio Perillo | Apr 30, 2008 12:16 pm | |
| Manlio Perillo | May 1, 2008 2:42 am | |
| Grzegorz Nosek | May 1, 2008 11:28 am | |
| Manlio Perillo | May 1, 2008 12:02 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Feature request: Run a script when upstream detected down/up | Actions... |
|---|---|---|
| From: | François Battail (fb-f...@public.gmane.org) | |
| Date: | Apr 30, 2008 3:54:25 am | |
| List: | ru.sysoev.nginx | |
Mansoor Peerbhoy <mansoor@...> writes:
a) for instance, having an external program monitor nginx logs for a
particular log message (or "event"), [...]
OK, that's monitoring but still require lot of system calls and even bandwidth.
b) with this approach, the problem of counting the number of times an event
was fired in a particular time [...]
True, but it's no more monitoring but debugging.
c) also, if this event approach is taken further, this can also be used as a
non-intrusive way of profiling
True, but it's no more monitoring but profiling.
d) and it is also purely in the spirit of a webserver -- apache, if you
recollect, can pipe its access log to a program [...]
It's Unix philosophy: "everything is a file" but sometimes a more pragmatic approach is more efficient. Redirecting logs to another server or program can be useful but most likely to do heavy statistical computations or intrusion tentative detection or legal access log archivage.
What's the purpose of an error log? To help to traceback an incident. What's the purpose of monitoring? To told you there is an incident and to give you valuable data to understand what kind of incident it is.
It's not the same thing, so it's not the same tools.
At this time, the few things monitored by Nginx are provided by the stub_status module. How it works: you make an HTTP GET on a specific loation and it will returns some variable values in text form.
What I propose is a more general mechanism which is to use shared memory instead of an HTTP request. As most scripting languages offer the access to shared memory you can do what you want after.
How it should work?
A Nginx module wanting to have some variables monitored should register these during init, something like:
ngx_monitored_value_t * ngx_register_monitoring_value (ngx_string_t * name) ;
Nginx will then reserve an area in the shared memory to store:
"<name>:XXXXXXXX\n"
After startup the module will modify the value using the atomic_t primitives. And at the end of the main worker cycle for each variable monitored we simply do a loop to "snprintf" the value into the area in shared memory.
Nginx is of course write only for security reason.
Then you will be able to exploit the data, something like this:
accept:00000002 read:000000001 write:000000001 wait:000000001 mybackendserver1status:00000000 mybackendserver2status:00000001 ...
How it costs? The cost of modifying under mutex or spinlock the variables (already the case for the sub_status module) and the cost, for each variable, to do an sprintf to transform an integer into its hexadecimal representation. Say 100 assembly instructions each time the main worker do a cycle, it's nothing. I'm sure it's way faster than sub_status_module ;-)
It's easy, simple, fast and useful (at least for one person). The sub_status module is not affected only the Nagios and Collectd plugins need to be upgraded to exploit the shared memory, not a big deal I think.
Best regards.







