EPN

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Thu Apr 24 12:40:04 CEST 2003


Dear Sir,

I am writing to thank you for your letter and say,

On Thu, Apr 24, 2003 at 11:24:09AM +0200, Lionel.Ostric at arm.com wrote:
> 
>       Are some of you using the Embedded Perl Interpreter with Nagios ?

and loving it.

tsitc# ./nagios -m

Nagios 1.0
Copyright (c) 1999-2002 Ethan Galstad (nagios at nagios.org)
Last Modified: 11-24-2002
License: GPL

External Data I/O
-----------------
Object Data:      TEMPLATE
Status Data:      DEFAULT
Retention Data:   DEFAULT
Comment Data:     DEFAULT
Downtime Data:    DEFAULT
Performance Data: DEFAULT

Options
-------
* Embedded Perl compiler (With caching)


tsitc# 


>       If yes, do you have to change something in the config files to make
> nagios use the Embeded interpreter instead of spawning a perl each time ?
>

No. 

As long as you have a shee-bang (#!) line containing /bin/perl (see
base/checks.c) in your Perl program - and you must have a shee-bang line
with a path yo Perl for your program to run at the CLI - Nagios will
processe it with the embedded Perl intrepreter.

This means that 

1 Perl will not be forked to run the plugin; the plugin will be run by
the Perl interpreter _built in_ to the Nagios program.

Have a look at check.c: instead of calling popen() (ie fork + exec +
wait) it calls perl_call_argv(), a function that is in the Nag program -
because Perl is.

2 If you compile Perl with Perl caching (see above), the Perl
interpreter in Nag will not be called to eval() the Perl program (ie
compile it) each time the plugin runs (because it will have already been
compiled and the Perl op-code tree will already be in core, ready to
run). This is also a win.

If you are seeing Perl forks, then something else (AFAIK) is responsible
for them.

Perhaps truss'ing the nag process would show whats being exec'ed after
the Nagios fork. Not so convincing.

AFAIK, any Perl program, be it plugin, event-handler,
notification-program etc is run by Nag without a fork _and_ exec of
Perl. Nag still forksbut instead of the new process being overwritten by
Perl and that being called with the plugin, Nagios handles the plugin as
if it is a local function call (which it is: to perl_call_argv()).

ePN trades off fork() and exec() calls against memory usage and slightly
less
reliability eg for 200 hosts 350 services

  PID USERNAME       PRI NICE  SIZE    RES STATE    TIME   WCPU    CPU
COMMAND
78080 nagios           2   0 49340K 15116K select   0:00  3.15%  0.44%
nagios
78094 nagios           2   0 49248K 14492K sbwait   0:00  4.00%  0.20%
nagios

after perhaps a week running. Without ePN, Nag would use far less core.

The ePN support is no where near as sophisticated as Apache mod_perl but
it works Ok. I would hesitate to forgo it since I use a lot of custom
Perl plugins (stuff that use lots of Perl modules like LWP or the
DBI/DBD stuff).

 
>       I already recompiled nagios with EPN but it does not seems to use it
> ....
>

 
> Thanks for your help
>

Yours sincerely. 

-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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