[SNMP4J] Textual Oid using the name instead of number

Martin.Duerrmeier at innovations.de Martin.Duerrmeier at innovations.de
Mon Sep 6 19:18:55 CEST 2010


Hi,
I'm using snmp4j Version 1.11.1 and did an example Application according to http://www.snmp4j.org/doc/org/snmp4j/Snmp.html and could successfully get a Ram Cache Value.
With 
  pdu.add(new VariableBinding(new OID(".1.3.6.1.4.1.2021.4.15.0"))) 
  pdu.setType(PDU.GET);
  snmp.send(pdu, target, null, listener);
and 
  event.getResponse().get(0).getVariable().toString(); in the ResponseListener.

How can I get the same value with the textual String?

According to http://www.snmp4j.org/doc/org/snmp4j/smi/OID.html I can just write new OID("'memCached'.0")
But then I get an "Error Code: 2" for "pdu.getErrorStatus()" which is "SNMP_ERROR_NO_SUCH_NAME"

How can I convert a numeric oid into the character representation and vice versa?

Here is what an snmp get shows on command line

snmpget -c public -v 1 127.0.0.1 memCached.0
UCD-SNMP-MIB::memCached.0 = INTEGER: 131700 kB

snmpget -c public -v 1 127.0.0.1 1.3.6.1.4.1.2021.4.15.0
UCD-SNMP-MIB::memCached.0 = INTEGER: 131700 kB

Any help warmly welcomed :)

Regards

Martin Dürrmeier



More information about the SNMP4J mailing list