Load MIB using SNMP4J

bee81 picture bee81 · Oct 25, 2013 · Viewed 8.3k times · Source

I am totally new to mib and i have read about snmp on techdive and get the basic understanding of SNMP4J can anyone tell me how to use MIB in snmp4j ? Thank in Advance

Answer

Kevin Bayes picture Kevin Bayes · Oct 25, 2013

Sure. You basically query a client for information giving an OID for the field in the MIB you require.

A basic sample taken from the referenced blog is:

PDU request = new PDU();
request.setType(PDU.GET);
OID oid= new OID("1.3.6.1.2.1.1.1.0");
request.add(new VariableBinding(oid));

The reference you can use: http://www.jineshmathew.com/2012/11/how-to-get-started-with-snmp4j.html

Here is another reference: http://www.jayway.com/2010/05/21/introduction-to-snmp4j/

Here is the java doc for the OID: http://www.snmp4j.org/doc/org/snmp4j/smi/OID.html