14 messages in ru.sysoev.nginxFeature requestED: monitoring Nginx f...
FromSent OnAttachments
François BattailApr 30, 2008 12:29 pm 
Manlio PerilloApr 30, 2008 1:16 pm 
François BattailApr 30, 2008 1:39 pm 
Manlio PerilloMay 1, 2008 1:30 am 
François BattailMay 1, 2008 1:58 am 
Manlio PerilloMay 1, 2008 2:39 am 
François BattailMay 1, 2008 5:42 am 
Rt IbmerMay 1, 2008 9:59 am 
Grzegorz NosekMay 1, 2008 11:35 am 
Manlio PerilloMay 1, 2008 11:57 am 
François BattailMay 1, 2008 1:25 pm 
Manlio PerilloMay 2, 2008 1:52 am 
François BattailMay 2, 2008 6:50 am 
Rt IbmerMay 2, 2008 10:31 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Feature requestED: monitoring Nginx from the outsideActions...
From:François Battail (fb-f@public.gmane.org)
Date:Apr 30, 2008 12:29:16 pm
List:ru.sysoev.nginx

I've almost finished the module (read: compilation reports no error) and want to take some time to discuss about some potential issues.

1) Interaction with Nginx

I try to not affect Nginx but some files need to be modified since this module offer a very simple API to other modules, so there are two paths: mandatory module but activated or not by the config file or conditional compilation. I believe conditional compilation is the norm but please let me know.

To access the shared memory I want to create a file: nginx.monitoring at the same location as nginx.pid. Then a ftok() on this file to get the System V ID and another process would be able to attach to the shared memory. But as I'm a Linux guy I don't know if *BSD, Mac-OSX and Solaris would be OK with this. Don't know too if all scripting languages can use System V calls.

So far I think it is clean but if you have a suggestion better you're welcome.

2) API

The API consist in one call:

void ngx_register_monitoring_value (ngx_str_t * name, ngx_atomic_t * value) ;

This function should be called by an Nginx module during it's initialization to tell the monitoring module that this variable should be added to the pool for watching. That's all. The module just continue to do what it wants with its ngx_atomic_t value, I will do the rest.

I may have some issue because my module has three states: initializing, registering, running so may be the order of modules may be problematic.

3) Configuration

At top level just put 'monitoring ;'. But some modules offering variables to be monitored may propose configuration options like:

monitor_timeout_counter on ;

and call or not ngx_register_monitoring_value() according to the setting.

4) Scripts

A script should have read access to where nginx.pid is and will do the following pseudo code:

shm_id = ftok ("path.to.nginx.monitoring") ; mem = attach_to_shared_mem (shm_id) ; values = parse (mem) do_what_you_want_with_values (values)

for example: update RRD databases, search for an anormal error count, search for an event unexpected...

It's no more my problem :-)

5) Conclusion

Dear List, tell me what you think and I will release soon this module (under A BSD-like licence of course) for review and comments.

Best regards.