Need guidance on SNMP::translateObj

E

Eric Stanfield

I'm trying to use translateObj to dupliate the return value of
the cmd line snmptranslate utility. Looking for some guidance
as I've had no luck combing through a hundred posts to see
what I'm doing wrong. translateObj never seems to translate
between raw numeric OID's and "pretty" OID's such as I can get from
the cmd line.

I've posted the different behavior I'm seeing from both Perl
and the cmd line below for reference. The point of this is I
need string output back form Perl for various reasons - getting
numeric OID's spit back isn't going to cut it.


#!/usr/bin/perl

use SNMP;
use SNMP_util;

@xxx = &snmpwalk("public\@10.0.254.109",".1.3.6.1.2.1.25.2.3");

foreach $line (@xxx) {

print &SNMP::translateObj($line, 1)."\n";

}

Returns:

..1.1.1
..1.1.2
..1.1.3
..1.1.4
..1.1.5
..1.2.1.3.6.1.2.1.25.2.1.5
..1.2.2.3.6.1.2.1.25.2.1.4
..1.2.3.3.6.1.2.1.25.2.1.4
..1.2.4.3.6.1.2.1.25.2.1.7
..1.2.5.3.6.1.2.1.25.2.1.3
<etc, etc>

Whereas >snmptranslate -Ofn .1.3.6.1.2.1.25.2.3

Returns: .iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.6.1.2.1.25.2.3
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top