translateObj() for OID to MIB in perl is incomplete

Tobias Bender <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAFwpYyMACk5bFUbyy0RanaFpiP5mhj48GpMOwtZOtJx4A27gtg@mail.gmail.com>
Hi,

the vice-versa translation of the perl-module (SNMP::translateObj(); )
doesn't work correctly in both ways.
The MIB is translated to an OID correctly, but the translation from
OID to MIB is incomplete.

Version is 5.5 (i guess):
# snmpget -V
NET-SNMP version: 5.5

Heres the example perl-code:

	my $mib = "QDDNS-SERVER-MIB::dnsServCounterRequests.query.in.a.udp";
	my $oid_a_records = SNMP::translateObj("$mib");
	print "$oid_a_records\n";
	->	.1.3.6.1.4.1.1751.1.48.1.2.2.1.5.1.1.5.0.1.1.1

thats correct, but when i translate this back into a MIB, i get this:

	my $back2mib = SNMP::translateObj("$oid_a_records",0,1);
	print "$back2mib\n";
	->	QDDNS-SERVER-MIB::dnsServCounterRequests.0.1.1.1
	
Changing the ARGs of the last method-call doesn't change something. I
played around with snmptranslate on shell-level:

	# snmptranslate QDDNS-SERVER-MIB::dnsServCounterRequests.query.in.a.udp -On
	.1.3.6.1.4.1.1751.1.48.1.2.2.1.5.1.1.5.0.1.1.1
	# snmptranslate .1.3.6.1.4.1.1751.1.48.1.2.2.1.5.1.1.5.0.1.1.1
	QDDNS-SERVER-MIB::dnsServCounterRequests.query.in.a.udp
	# snmptranslate .1.3.6.1.4.1.1751.1.48.1.2.2.1.5.1.1.5.0.1.1.1 -Td
	QDDNS-SERVER-MIB::dnsServCounterRequests.query.in.a.udp
	dnsServCounterRequests OBJECT-TYPE
	-- FROM       QDDNS-SERVER-MIB
	SYNTAX        Counter32
	MAX-ACCESS    read-only
	STATUS        current
	DESCRIPTION   "Number of requests (queries) that have been recorded in
				this row of the table."
	::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1)
lucent(1751) products(1) vitalqip(48) vitalqipServices(1)
vitalqipDNS(2) dnsServMib(2) dnsServMibObjects(1)
dnsServCounterQuery(5) dnsServCounterTable(1) dnsServCounterEntry(1)
dnsServCounterRequests(5) 0 1 1 1 }

Note that it works correctly, but on the last line of the long output
the last numbers weren't translated like it was in perl.

This is a problem i found while getting used to perl/snmp. On the long
run, the perl script should perform several GETs and GETNEXTs and save
the result in a hash (with "MIB-Name" as Index and the returned value
as value for this index).
In my current thought about setting this up, i need to translate the
MIB to an OID to perform the query. But since i only know the 1st MIB
when performing GETNEXT (during a snmpwalk-like method in perl), i
need to translate the other OIDs back to MIBs when saving them in
hash.
Like i said, this is my current mindset of getting this done, but i'm
open to other approaches, if mine is broken by design.

As far as my knowledge about MIB-Files goes, i think the last 4 digits
of the OID (query.in.a.udp) are defined in 4 bulks:
4 Statements with query/update, IN/CH, A/PTR/CNAME and UDP/TCP and
snmp creates every possible combination of this. A snmpwalk in shell
returns values for query.in.a.udp, query.in.a.tcp, query.ch.a.udp and
so on.(massive output)

I hope this is enough information to get help on this.

Regards,
 Tobias

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
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.