http://www.mibble.org is another place to look. Simple example is below:

private void name2OID() {
       String oid = null;
       try {
           MibLoader mibLoader = new MibLoader();
           Mib mib = mibLoader.load("SNMPv2-MIB");
           MibSymbol symbol = mib.getSymbol("sysName");
           if (symbol != null && symbol instanceof MibValueSymbol) {
               MibValue value = ((MibValueSymbol) symbol).getValue();
               if (value instanceof ObjectIdentifierValue) {
                   oid = ((ObjectIdentifierValue) value).toString();
               }
           }
           System.out.println(oid);
       } catch (Exception ex) {
           ex.printStackTrace();
       }
   }

Jeff Pople wrote:
I am aiming to provide a very simple web control
interface to a device, using SNMP4J behind the scenes.
  I have a prototype running which essentially uses
the SNMPRequest class and I can sucessfully issue GETs
and SETs to the device.

Now, if I use 'snmptrap' from the command line, I can
issue GETs by variable name (e.g sysName.0) but with
SNMPRequest, I have to use the numeric OID (e.g. 1.3.6.1.2.1.1.5.0) - the label name fails a validation
check as non-numeric.

I am sure there is an easy way to do this with SNMP4J
but it escapes me. Can anyone help or even provide an
example?
Regards

Jeff

_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j

Reply via email to