On usage of check_procs

Andreas Ericsson ae at op5.se
Thu Aug 11 10:26:08 CEST 2005


Ralph.Grothe at itdz-berlin.de wrote:
> Hi Andreas,
> 
> While on the performance subject.
> I'm not quite into C hacking.
> I guess it would cost me at least ten times as long as doing it
> in Perl.
> (besides, I guess that the perils of memory leaks, dangling
> pointers etc. owe to my unwary coding in C 
> were more serious, Perl has a nice garbage collector that cleans
> things up silently as soon
> as a thingy goes out of scope)

The kernel has one even nicer that does the same thing. Whenever a 
program stops its blocks are marked free by the kernel. For a simple 
plugin you don't have to worry about free()'ing anything (most plugins 
don't, at that).

> That's why I prefer writing my own plug-ins in Perl.
> When browsing through the docs I also came accross the chapter on
> envPerl.
> Since I haven't built my nagios binary with envPerl enabled,
> and since I regarded that topic one of the more advanced (for
> later deliberation),
> I haven't yet cared much about it.
> Is there more documentation, howtos, examples on envPerl than is
> in the Nagios docs?


Not really, no. All you have to think about it make sure your perl 
scripts run cleanly with the strict pragma, and make sure you initialize 
all variables on each run. Since the scripts will be cached they will 
maintain the value of each variable since it was last run.


> E.g. the mod_perl Apache fork dedicated a whole site with an
> abundance of documentation
> to their built-in Perl.
> How does an envPerl Nagios compare to a standard one?
> 

It runs perl scripts through an embedded interpreter (this saves quite a 
bit on some systems, and very little on others. It all depends on how 
large your perl installation is, and if you have sufficient memory to 
let the system cache the perl binary for you), and optionally caches 
them (this saves even more, since each script won't have to be compiled 
every time its run, but can instead be stored in byte-code in the Nagios 
process' memory).


Historically there has been lots of problems with the embedded perl 
thingie, but according to Stanley Hopcroft, who's done most of the 
recent work on it and is the only one with a clue to both C and Perl 
that uses it (that I know of), it's much better lately and hardly leaks 
any memory at all. As for performance improvements, I haven't seen any 
actual measurements, but logic provides that it should be a fair bit 
faster than running perl-scripts the usual way.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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