[SNMP4J] is there something special about a SET command?

Laux Thorsten Com ESY HD 733 thorsten.laux at siemens.com
Tue Apr 12 10:16:49 CEST 2005


Hi Noel!

Seems to me, you might not have set the fully-qualified OID. You write, that
you use GETNEXT to retrieve the element. For setting it you need to
fully-qualify the OID:

Example:

A GETNEXT on sysName 1.3.6.1.2.1.1.5 provides the fully-qualified element
1.3.6.1.2.1.1.5.0 with a value.
So if you try to set this value, you have to provide the OID
1.3.6.1.2.1.1.5.0 with a value in your SET-command.

For your code this means:  add a ".0" (the instance's index) to your OID to
set the value.

I hope this helps you out...

Greetings,
Thorsten

P.S. This won't work for tabular elements, because there the indices are
somewhat different.


-----Ursprüngliche Nachricht-----
Von: Noel Grandin [mailto:noel at peralex.com] 
Gesendet: Dienstag, 12. April 2005 10:06
An: snmp4j at agentpp.org
Betreff: [SNMP4J] is there something special about a SET command?

Hi

My code basically looks like:

   final PDU pdu = new PDU();
   pdu.add(new VariableBinding(new OID(oid), new Integer32(val)));
   pdu.setType(PDU.SET);

   final CommunityTarget target = new CommunityTarget(new
UdpAddress(ipAddress + "/161"), new OctetString(community));
   target.setVersion(SnmpConstants.version2c);
   target.setRetries(0);
   target.setTimeout(60000);

   final ResponseEvent responseEvent = snmp.send(pdu, target);

But the device keeps responding "No such name", but I know the OID name
exists because I can do a GETNEXT to retrieve 
it's value.
Is there something special one needs to do for SET commands?

Thanks,
    Noel

NOTICE: Please note that this email, and the contents thereof, 
are subject to the standard Peralex email disclaimer, which may 
be found at: http://www.peralex.com/disclaimer.html

If you cannot access the disclaimer through the URL attached 
 and you wish to receive a copy thereof please send 
 an email to email at peralex.com



More information about the SNMP4J mailing list