Embedded Perl in Nagios 4

Andreas Ericsson ae at op5.se
Fri Jan 18 13:37:07 CET 2013


On 01/18/2013 12:29 PM, Matthew Jurgens wrote:
> Hi Andreas
> 
> op5 sponsor the Check WMI Plus plugin (http://edcint.co.nz/checkwmiplus/?q=donations_and_sponsorship).
> Its a large perl plugin where the lack of embedded perl would approx double the amount of CPU that it uses.

Actually, it's a large perl shim around a C binary called "wmic". Most
of the time it uses is spent in network latency because there's no way
the shim can get the compiled binary to do all its work for it in a
single session.

check_wmi is one of the (very many) plugins where embedded perl wouldn't
improve things in any way what so ever, and the only way to get real
performance out of it is to rewrite the wmic binary so that it can
handle communication with the perl plugin, or so that wmic itself is
turned into a plugin.

Where embedded perl *does* matter is for perl plugins that utilize a
large set of perl libraries. For those cases, embedded perl can cut
execution time of plugins down to as much as 25% of the original cpu
and I/O cost.

However, the new worker model is still up to 12 times more efficient
than the old one, so at best you're looking at a tiebreak for running
perl plugins.

> There are people using it so much (multiple tens of thousands of invocations per day) that they already notice the amount of CPU that it consumes.
> 

I'm sure they do, and patches to make language-specific workers work
fine out of the box are ofcourse welcome, along with the code to
make such workers fly.

> I'm hoping the op5 can assist with a solution to the Nagios 4 problem of no embedded Perl.

It's not a problem that Nagios 4 has no embedded perl. It used to be
a problem that Nagios 3 with embedded perl enabled leaked so much
memory that the system became unusable after a day or two of running.
This is (potentially) a performance issue caused by a single plugin
being heavily used in spite of it being crap code that just wraps a
second program.

> Why has it been taken out anyway?

For all the reasons stated above.

> There are a lot of plugins out there that use Perl.
> 

And for the most part it's still faster to run checks with Nagios 4
without embedded perl than it is to run checks with Nagios 3 with
embedded perl compiled in and enabled.

The only exception is where large and heavy plugins written in perl
are extensively and almost exclusively used, and the perl loadtime
dominates the time it takes for the plugin to run. That's not the
case with check_wmi.

For a workaround, you may want to look into mod_gearman. It's one of
the unofficially blessed eventbroker modules that are known to work
well with Nagios 4, and as a happy coincidence it still supports
embedded perl. I know for a fact that Nagios 4 with mod_gearman works
very well, and if you put your perl-based checks in a single service
group and let mod_gearman handle only those, you'll have a system
that can easily handle tens of thousands of checks without breaking a
sweat.

As a final note; Embedded perl *may* yet come back to Nagios. If it
does, it will be as a multi-stage rocket that goes like this:
1. Make Nagios recognize different script languages.
2. Make Nagios' worker process manager capable of distributing checks
   based on scripting language.
3. Build a special-purpose worker that supports perl caching and
   whatnot and get it included in Nagios.

Given that it's done properly and the code holds good quality, I'd be
more than happy to take patches that implements script recognition and
a perl-worker. Note that the worker will have to be able to handle the
case when plugins can't be executed by it since they don't conform to
whatever rules the embedded perl layer chucks up.

It will, however, *never* be in the plain core worker, which is meant
to be as stable and simple as possible.

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

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list