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
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