Re: [Mibble-users] newbie question about using mibble

2012-09-19 Thread Per Cederberg
Check the bundled source code for the MibbleBrowser app. It performs
reverse lookups on the OIDs returned in GetNext SNMP responses.

Cheers,

/Per

On Wednesday, September 19, 2012, Lloyd Parkes wrote:


 On 19/09/2012, at 1:26 PM, diffuser78 diffuse...@gmail.com javascript:;
 wrote:

  Quick question: Which class should I use if I want to get the OID by
 giving Symbol, i.e getOID(ifMIB) will return me 1.3.6.1.2.1.31 ?

 I avoided talking about this in my earlier message because it's hard and
 the reason it's hard is because ASN.1 is hard.

 In ASN.1 symbols don't have to refer to OIDs. SNMP users (like me) live in
 a world that only has SNMP variables, which alway do have an OID, but ASN.1
 symbols and are not equivalent to SNMP variable names. When I had to work
 this out, I spent some time in a Java debugger traversing the links between
 all the objects and noting the useful information I found on a whiteboard.

 I don't think I needed to do what you want to do, so I don't have any code
 on hand for it, but what I think you need to do once get a MibValueSymbol
 is to call its getValue() method and cast the result to an
 ObjectIdentifierValue. You should use instanceof to verify that the object
 really is an ObjectIdentifierValue before casting of course. The
 ObjectIdentifierValue class as a method toAsn1String() that returns the
 string you are after.

 Cheers,
 Lloyd


 ___
 Mibble-users mailing list
 Mibble-users@nongnu.org javascript:;
 https://lists.nongnu.org/mailman/listinfo/mibble-users

___
Mibble-users mailing list
Mibble-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/mibble-users


Re: [Mibble-users] newbie question about using mibble

2012-09-18 Thread diffuser78
Hey Lloyd,

Quick question: Which class should I use if I want to get the OID by giving
Symbol, i.e getOID(ifMIB) will return me 1.3.6.1.2.1.31 ?

Thanks.

On Thu, Sep 13, 2012 at 2:25 PM, Lloyd Parkes ll...@must-have-coffee.gen.nz
 wrote:


 On 14/09/2012, at 5:34 AM, diffuser78 diffuse...@gmail.com wrote:

  Hi All,
 
  I am a newbie at Java and mibble both. Can you please point me how to
 get started for the following:
 
  1. I want to read http://net-snmp.sourceforge.net/docs/mibs/IF-MIB.txt( I 
  am assuming I will use MibLoader to load and read this, please correct
 me if I am wrong)

 Mibble has a local copy of IF-MIB, so you don't need to read it off the
 internet.

 MibLoader mibLoader = new MibLoader ();
 Mib ifMib = mibLoader.load (IF-MIB);

  2. I want to to be able to get OID values if I provide snmp object names
 as follows: i.e if I want snmp object for 1.3.6.1.2.1.2 then mibble gives
 me interfaces.  What class or api will I need

 MibValueSymbol interfaces = ifMib.getSymbolByOid (1.3.6.1.2.1.2);

 Cheers,
 Lloyd


 ___
 Mibble-users mailing list
 Mibble-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/mibble-users

___
Mibble-users mailing list
Mibble-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/mibble-users