I use SNMP4J and try to set some value.
Variable var = OctetString.fromHexString(v);
VariableBinding varBind = new VariableBinding(new OID(o),var);
pdu.add(varBind);
pdu.setRequestID(new Integer32(1));
pdu.setType(PDU.SET);
Snmp snmp = new Snmp(transport);
ResponseEvent response = snmp.set(pdu, comtarget);
if (response != null){
PDU responsePDU = response.getResponse();
if (responsePDU != null){
int errorStatus = responsePDU.getErrorStatus();
String errorStatusText = responsePDU.getErrorStatusText();
if (errorStatus == PDU.noError) return responsePDU.get(0).getVariable().toString();
else return errorStatusText;
}else return "No response";
}else return null;
Its work fine, but sometimes i got error Undo failed
Does any one know what the reason of this error and how can I fix it?
The error code
Undo Failedmeans thatThis is essentially telling you that it doesn’t know how much of the original set operation was completed, and things might be left in an inconsistent state. I don’t know enough about SNMP error reporting details to know if the response contains additional error codes describing the earlier problem.
BTW, it took all of 20 seconds to find this information using Google.