Thanks for the detailed information. By "derive this kind of information from the agent", I mean is it possible to get the OID name to identifier mapping by putting some additional log statements into a common API? Any by collecting all the log statements, I will be able to get this kind of mapping?
The situation is we do not have MIB files as such and I want to generate the MIB from the code. Some kind of reverse engineering the MIB to say... -----Original Message----- From: dave.shi...@gmail.com [mailto:dave.shi...@gmail.com] On Behalf Of Dave Shield Sent: Tuesday, August 07, 2012 5:22 PM To: Siva Esana -X (sesana - Tech Mahindra at Cisco) Cc: net-snmp-coders@lists.sourceforge.net Subject: Re: OID name to numeric mapping. On 7 August 2012 12:41, Siva Esana -X (sesana - Tech Mahindra at Cisco) <ses...@cisco.com> wrote: > But do the net-snmp agent also keeps the mapping array for its own purpose? Short answer: no, not really Longer answer: yes, but... Full answer: There are two situations where the agent needs to make a connection between numeric OIDs, and the MIB object definition (name, type, description, etc). One is when processing the config file. If this makes reference to MIB object names (e.g. when setting up access control to particular portions of the MIB tree), then the agent needs to be able to turn these into the equivalent numeric OIDs. That's essentially the same as the client-side handling of MIBs. The other is when processing an incoming request - given such and such an OID, what should value should be returned. This is basically handled by hardcoding this mapping into the source code for that particular set of MIB modules. If you look at the code for any of the MIB modules, they all start by "registering" a particular OID - saying "If the agent receives a request for this bit of the MIB tree, this is the code to handle it." But that OID (and the details of the objects within it) is all embedded within the code itself. There's no simple lookup of "this OID is this object, and here's the value" > I know some agent keeps an array where it maps all the OID names and the > associated numeric identifiers. > > Likewise do net-snmp maintains any such array of all the registered objects? > For example, > > {" 1.3.6.1.2.1.2.1", "ifNumber"}, > { " 1.3.6.1.2.1.2.2", "ifTable" }, > {" 1.3.6.1.2.1.2.2.1", "ifEntry"}, > {" 1.3.6.1.2.1.2.2.1.1", "ifIndex"}, > {" 1.3.6.1.2.1.2.2.1.2", "ifDescr"}, No. The Net-SNMP agent doesn't work that way. > Or is there a way to derive this kind of information from the agent? What do you mean by "derive this information from the agent?" What exactly are you trying to do? Dave ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders