[Nagiosplug-devel] RFC: Nagios 3 and Embedded Perl Plugins

Andreas Ericsson ae at op5.se
Sun Jan 7 20:14:19 CET 2007


sean finney wrote:
> hey guys,
> 
>>>
>> Yes. It all piles up rather quickly. To be honest, I like the fact that 
>> plugins are external programs. Mainly because it allows fast and 
>> free-style development in any language the system you're on can run, but 
>> also because it allows drop-in replacement of plugins without having to 
>> restart Nagios.
> 
> and also for posterity... around the time i mentioned above, andreas and
> i had a long and drawn out conversation about possibly "embedding"
> plugins by compiling them as .so libraries and use of dlopen().  this
> would allow for removing 2 of the 3 fork calls involved in each popen()
> type call (iirc), and would remove the need to exec() anything.
> 
> unfortunately, this comes at the cost of many memory leaks (not many
> plugins bother to even call free()), possible crashing of the nagios daemon,
> and lots of code-rewriting... and the performance increase is only
> marginal since in most cases the real bottleneck is the first fork/exec
> call being done serially from the nagios daemon.  better would be to
> remove/rewrite the fork/exec bottleneck by having a pool of worker
> threads that could do it in a more parallel fashion--this was also a
> result of the old discussion iirc.
> 

Actually, the testprograms I wrote showed that spawning several 
processes from a single thread and multiplexing their output was by far 
the most scalable solution. With this method, it's possible to run up to 
(((ulimit -n) / 2) - 5) checks simultaneously (generally ~500, although 
the ulimit can be raised to as much as 1024 * 1024 on Linux).

The threading model made certain requirements of the daemon program 
which made it unsuitable for use in Nagios, and on Linux with glibc 2.4 
and the Native POSIX thread library the cap was hit at ~300 checks, 
irrespective of ulimit values.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231





More information about the Devel mailing list