Re: convert string to oid

Beluc <[email protected]>
Newsgroups gmane.network.mrtg.user
Message-ID <CANZf72Df94FVBCS+sodSVYno_aRz+Vx8iaosBGbVLKL2g7ubdA@mail.gmail.com>
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 <[email protected]>:

> 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":[email protected]:::::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*
>
> [email protected]
>
>
>

_______________________________________________
mrtg mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.