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

Florian Gleixner flo at bier.homeip.net
Wed Jan 3 14:34:32 CET 2007

Andreas Ericsson wrote:
> Florian Gleixner wrote:
>> True, leaks and crashes could make nagios more unstable. dl-plugins
>> should be used with care. "Worker threads" could isolate some of the risk.
>> The performance gain is simply the time a C plugin needs to create a
>> process. You could say, that this is not very much time, but some nagios
>> setups make thousands of checks per minute. Here is a very simple test:
>> The bash has the echo command build in. On most linux systems you will
>> find a /bin/echo program with same functionality too. So compare:
>> time for ((i=0 ; i< 10000 ; i++)) ; do echo bla ; done
>> real    0m1.536s
>> user    0m0.172s
>> sys     0m0.020s
>> time for ((i=0 ; i< 10000 ; i++)) ; do /bin/echo bla ; done
>> real    0m34.047s
>> user    0m8.761s
>> sys     0m15.365s
>> I think some default plugins like ping or tcp-check could be made as dl
>> module, the more complicated or the plugins that are usually executed at
>> the monitored nodes should be "normal" plugins.
>> I never had a look at the nagios code, it was just a idea popping up.
> A lower hanging apple is to make Nagios use fork() / execve() instead of 
> using popen(), which does a double fork() / exec() thing.

or use the popen() call from popen.{h,c} from the nagios plugins.
The nagios plugins also call external programs via this call. So at the
moment one plugin check usually creates a shell process, the plugin
executable process and if the plugin creates a process we have three
process created for one simple ping.
Ideally a dynamically loaded plugin, that does not call external
programs but has the code of for example "ping" complied in, does not
create a single process.

More information about the Devel mailing list