Re: [Nagios-users] Embedded Perl in Nagios 4

2013-01-18 Thread Andreas Ericsson
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.erics...@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@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


[Nagios-users] Embedded Perl in Nagios 4

2012-12-18 Thread Samuel Kidman
Hello

I just had a look at Ethan's slide decks on Nagios 4 from 2012 Nagios 
Conference, and found out that embedded perl won't be in Nagios 4. I'm running 
a distributed Nagios deployment that makes extensive use of perl plugins, and 
the performance of my Nagios servers is beginning to struggle a bit as a 
result. I was working on making my plugins work with embedded perl but since 
this is now not an option I was wondering what others will be doing to optimise 
perl plugins without embedded perl?

Thanks
Sam Kidman
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
Nagios-users mailing list
Nagios-users@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

Re: [Nagios-users] Embedded Perl in Nagios 4

2012-12-18 Thread Andreas Ericsson
On 12/18/2012 09:29 AM, Samuel Kidman wrote:
 Hello
 
 I just had a look at Ethan's slide decks on Nagios 4 from 2012 Nagios
 Conference, and found out that embedded perl won't be in Nagios 4.
 I'm running a distributed Nagios deployment that makes extensive use
 of perl plugins, and the performance of my Nagios servers is
 beginning to struggle a bit as a result. I was working on making my
 plugins work with embedded perl but since this is now not an option I
 was wondering what others will be doing to optimise perl plugins
 without embedded perl?
 

For starters, you should just upgrade and it's entirely possible that
the performance issues go away completely. Nagios 4 has awesome check
scaling.

The second thing to do would be to look into running mod_gearman with
workers living on the same server as the master Nagios process.
mod_gearman still has embedded perl support (although it really only
makes a difference for large plugins).

The third thing to do would be to inspect your most expensive plugins
(expensive in terms of Perl loadtime multiplied by the number of times
the plugin is used for any given time interval) and see if rewriting
them in a different language makes a huge difference. We did that for
the snmp interface checks when one of our large customers wanted to
monitor some 6 services. Perl simply wasn't fast enough. Embedding
it meant we couldn't fork() fast enough (embedding languages has its
own overhead too), and it still leaked memory, so we rewrote them in C
and we cut system load by more than 85%.

The fourth thing to do would be to either sponsor a developer or buy
development time to build a special-purpose Nagios worker that handles
perl checks and that has a perl interpreter and a cache embedded. It's
not certain that would be better than just running the perl interpreter
directly. Without a cache, embedded perl is completely useless, since
it still has to bytecompile all the modules, and with it it can grow
to consume all memory on the system, no matter how carefully you write
your plugins. Tradeoffs, compromises and possible leaks no matter what
you do if you start down that route. It might be awesome though, so I
guess it could be worth a shot.

-- 
Andreas Ericsson   andreas.erics...@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.

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Nagios-users mailing list
Nagios-users@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