[SNMP4J] Querying by variable name vs. numeric OID
Fabrice Bacchella
fbacchella at spamcop.net
Wed Jun 4 13:22:15 CEST 2008
Too bad the code is under a GPL licence, and not LGPL :
Any software linking to Mibble (using one of it's classes) must also
be distributed under the terms of the GNU GPL (if at all distributed
to third parties).
A good way to kill a library.
Le 4 juin 08 à 12:36, George Chelidze a écrit :
> 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
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
More information about the SNMP4J
mailing list