[SNMP4J] Textual Oid using the name instead of number

Frank Fock fock at agentpp.com
Wed Sep 8 00:06:58 CEST 2010


Martin,

Runtime mapping from OID to object name and vice versa
is only needed for generic applications.
Best choice for the rest, is compile time mapping,
like done by AgenPro.

For runtime MIB parsing and processing, you may use
JASMI (http://www.mibdesigner.com) or some other
API. Note: JASMI 3.0 will be until September 13th.

Best regards,
Frank

On 06.09.2010 19:18, Martin.Duerrmeier at innovations.de wrote:
> 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
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list