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 Failed
means that
This 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.
There is little hope for you to fix, as if you dive into the RFC document,
http://www.ietf.org/rfc/rfc1448.txt
On page 25 the reason for undoFailed is documented.
Strictly speaking this is caused by the SNMP agent, and only its vendor can tell how to avoid it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.