[mrtg] Behaviour of PathAdd: and LibAdd:

Steve Shipway s.shipway at auckland.ac.nz
Wed Sep 19 02:01:42 CEST 2012

> > 1.       Modify MRTG_lib.pm to identify multiple use of these
> directives, and
> > push the values into @INC or $ENV{PATH} straight away, or
> >
> > 2.       Allow multiple values to be specified (possibly colon
> separated?)
> >
> I would recommend #2, being consistent with LoadMibs.  In the case of
> LoadMibs, the different mibs are space separated.

I agree - space separated is better, since Windows needs colons for drive letters, and VMS as path separators.  Plus, as you say, it is more consistent with LoadMibs.  Checking the code, LoadMibs seems to support comma separated as well...

To do this, I think that around line 800 of MRTG_lib.pm, we would need something like:

    if(defined $$cfg{pathadd}){
        foreach my $p (split /[,\s]+/, $$cfg{pathadd}) {
          $ENV{PATH} = "${p}${MRTG_lib::PS}$ENV{PATH}";
    if(defined $$cfg{libadd}){
        foreach my $p (split /[,\s]+/, $$cfg{libadd}) {
          debug('eval',"libadd $p\n");
          local $SIG{__DIE__};
          eval "use lib qw( $p )";

... to replace the existing parts.  This is very similar to the LoadMibs processing immediately above.  I've implemented it on our test server and it looks good so far.  Will probably be more work updating the documentation!



Steve Shipway
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: s.shipway at auckland.ac.nz
 Please consider the environment before printing this e-mail 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5900 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20120919/8454b4a0/attachment.bin 

More information about the mrtg mailing list