[Nagiosplug-devel] Integrating Nagios::Plugin into the distribution

Ton Voon ton.voon at altinity.com
Wed Apr 25 10:32:38 CEST 2007

On 24 Apr 2007, at 18:14, John P. Rouillard wrote:

> In message  
> <804160344192334BB21922E8082EA6C07DA3F3 at seaex01.180solutions.com>,
> "Thomas Guyot-Sionnest" writes:
>>> [mailto:nagiosplug-devel-bounces at lists.sourceforge.net] On
>>> Behalf Of Patrick Proy
>>> As a plugin dev I think using a specific directory for Perl
>>> module will
>>> create the same problem that I had with the config.pm file :
>>> the plugin
>>> won't run on all systems without changing the include path in
>>> the plugin.
>> I don't think that's an issue as you'll always be able to install
>> Nagios::Plugin system wide. This will only affect plugins  
>> installed by the
>> Nagios-plugins package and will ensure good QA over what we  
>> distribute.
> Well maybe. I have had to do installs for some customers where you
> can't by policy add files to the normal perl include paths. So having
> it be able to look in the nagios plugin tree by default for N::P would
> be a requirement at those shops.

Just to reinforce: The idea is that the perl scripts distributed with  
Nagios Plugins will have the following lines at the top:

   use FindBin qw($Bin);
   use lib "$Bin/../lib";
   use Nagios::Plugin;

This means that:
   1) @INC is prefixed with $Bin/../lib, thus pointing to a Nagios  
Plugins specific directory. $Bin is the directory where the plugin is  
run from
   2) Nagios::Plugin, with dependencies if required, is optionally  
installed in $Bin/../lib (which would be, by default, /usr/local/ 
   3) Nagios::Plugin is sourced from $Bin/../lib or system directories

To distribute plugins to target hosts, you will need the plugins in  
libexec/ and also the contents of lib/ (which also makes sense if we  
decide to have a dynamically linked C library in future).

I can see two potential issues:
   1) if root_dir is the top level, plugins have to exist in a lower  
directory (say, libexec/) and the perl modules have to live in a  
subdir too (say, lib/). You can't move the plugins into libexec/ 
local/ and expect them to work
   2) I'm not sure what happens with old versions of perl. Thomas  
thinks there may be @INC warnings, or there could be restrictions in  
the perl module dependency chain

BTW, this is not an intention to rewrite the C plugins - there is a  
need for C plugins, especially for the lower level system libraries.  
I believe N::P will lead to faster development of custom plugins.


T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon

More information about the Devel mailing list