Patch to properly poll() on the command pipe

Ethan Galstad nagios at nagios.org
Tue Jan 15 21:49:50 CET 2008


Thanks Thomas -

This patch will be in CVS shortly.

Thomas Guyot-Sionnest wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Ethan, hi list,
> 
> There's one thing that trickle me with nagios since I came across that
> code... In nagios v2, base/utils.c, there's the
> service_result_worker_thread function that uses poll calls to read from
> an ipc pipe, and there's the command_file_worker_thread (still present
> in Nagios v3) that seems to be a cut and paste of the previous function
> with polling replaced by a sleep timer because poll didn't work.
> 
> The reason poll didn't work is simply because to poll a named pipe, you
> must open it RDWR, so this patch takes back the code from nagios v2
> service_result_worker_thread to use polling on the command pipe.
> 
> I did it just for fun, but I'm wondering if you'd be interested in using
> is for Nagios v3 (this is against CVS HEAD btw). It worked well on my
> Ubuntu box with the following tests:
> 
> a. Running Nagios with 1500 passive checks accross 100 hosts getting
> their result from NSCA every minute at the exact same time (1)
> 
> b. Same as [a] while trying to keep the pipe full by cat'ing a file
> containing millions of check results for the same host/service (2)
> 
> (1) A perl script (attached too) forking 100 childs syncronized with a
> semaphore. every 60 seconds each child opens a pipe to send_nsca and
> prints 15 service results. nsca was configured not to aggregate writes.
> 
> (2) Running the following just before the semaphore fires off the childs
> (results.txt is big enough so that the command finishes after nagios is
> done processing the 1500 passive results):
>   $ `cat results.txt >>var/rw/nagios.cmd`
> 
> I guess this patch would help keeping the command pipe empty on huge
> distributed monitoring systems. As I said it was for fun, do whatever
> you want with it ;)
> 
> 
> Thomas


Ethan Galstad
Nagios Developer
___
Email: nagios at nagios.org
Web:   www.nagios.org

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/




More information about the Developers mailing list