[mrtg] convert string to oid

Beluc beluc62 at gmail.com
Fri Feb 21 11:56:08 CET 2014


Mike, i rewrite a bit your code and now it works for me :

(i use ^CLUSTER1^ instead of \"CLUSTER1\")

#!/usr/bin/perl

use strict;

my $var = $ARGV[0];
my $tmp;
    while ($var =~ /\^([^\^]+)\^/) {
      $tmp = join('.', map(ord, split('', $1)));
        my $length = length $1;
      $var =~ s/\^$1\^/$length.$tmp/;
    }

print "$var\n";

# perl test.pl"1.3.6.1.4.1.9.9.254.1.2.5.1.3.1.^CLUSTER1^&1.3.6.1.4.1.9.9.254.1.2.5.1.3.1.^CLUSTER1_PREDICTOR^"
1.3.6.1.4.1.9.9.254.1.2.5.1.3.1.8.67.76.85.83.84.69.82.49&1.3.6.1.4.1.9.9.254.1.2.5.1.3.1.18.67.76.85.83.84.69.82.49.95.80.82.69.68.73.67.84.79.82


2014-02-20 22:16 GMT+01:00 Steve Shipway <s.shipway at auckland.ac.nz>:

> Target[cluster1_test_failedconnections]:
> 1.3.6.1.4.1.9.9.254.1.2.5.1.3.1."CLUSTER1"&1.3.6.1.4.1.9.9.254.1.2.5.1.3.1."CLUSTER1_PREDICTOR":snmppub at 10.0.99.161:::::2
>
>
> MRTG doesn't do implicit table lookups or string expansion like this
> version of snmpwalk does.  You will need to give the OID explicitly in the
> Target definition.
>
>
>
> While you can use certain suffixes to an OID to append the implicit index
> of an **interface** you cannot do this generally for any table.  The
> backstroke you're using is implying a following interface description to
> MRTG, which is causing the problems.
>
>
>
> Steve
>
>
>
> *Steve Shipway*
>
> s.shipway at auckland.ac.nz
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20140221/8687b915/attachment-0001.htm 


More information about the mrtg mailing list