processSession.getProvenanceReporter().send(flowFile, this.snmpTarget.getAddress().toString()); } else { final String error = response.getResponse().getErrorStatusText(); flowFile = SNMPUtils.addAttribute(SNMPUtils.SNMP_PROP_PREFIX + "error", error, flowFile, processSession); processSession.transfer(processSession.penalize(flowFile), REL_FAILURE);
/** * Returns a string representation of the object. * * @return a string representation of the object. */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append(getTypeString(type)); buf.append("[requestID="); buf.append(requestID); buf.append(", errorStatus="); buf.append(getErrorStatusText()).append("(").append(errorStatus).append(")"); buf.append(", errorIndex="); buf.append(errorIndex); buf.append(", VBS["); for (int i = 0; i < variableBindings.size(); i++) { buf.append(variableBindings.get(i)); if (i + 1 < variableBindings.size()) { buf.append("; "); } } buf.append("]]"); return buf.toString(); }
/** * Returns a string representation of the object. * * @return a string representation of the object. */ public String toString() { StringBuffer buf = new StringBuffer(); buf.append(getTypeString(type)); buf.append("[requestID="); buf.append(requestID); buf.append(", errorStatus="); buf.append(getErrorStatusText()+"("+errorStatus+")"); buf.append(", errorIndex="); buf.append(errorIndex); buf.append(", VBS["); for (int i=0; i<variableBindings.size(); i++) { buf.append(variableBindings.get(i)); if (i+1 < variableBindings.size()) { buf.append("; "); } } buf.append("]]"); return buf.toString(); }
/** * Returns a string representation of the object. * * @return a string representation of the object. */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append(getTypeString(type)); buf.append("[requestID="); buf.append(requestID); buf.append(", errorStatus="); buf.append(getErrorStatusText()).append("(").append(errorStatus).append(")"); buf.append(", errorIndex="); buf.append(errorIndex); buf.append(", VBS["); for (int i=0; i<variableBindings.size(); i++) { buf.append(variableBindings.get(i)); if (i+1 < variableBindings.size()) { buf.append("; "); } } buf.append("]]"); return buf.toString(); }
curRsuMessage = "Deposit successful"; } else { curRsuMessage = "Deposit failed: " + response.getResponse().getErrorStatusText();
+ rsuResponse.getResponse().getErrorStatusText(); + rsuResponse.getResponse().getErrorStatus() + " " + rsuResponse.getResponse().getErrorStatusText());
", errorIndex=" + response.getErrorIndex() + ", " + "errorStatus=" + response.getErrorStatusText() + "(" + response.getErrorStatus() + ")"); printVariableBindings(response); ", errorIndex=" + response.getErrorIndex() + ", " + "errorStatus=" + response.getErrorStatusText() + "(" + response.getErrorStatus() + ")"); printVariableBindings(response);
", errorIndex=" + response.getErrorIndex() + ", " + "errorStatus=" + response.getErrorStatusText() + "(" + response.getErrorStatus() + ")"); printVariableBindings(response); ", errorIndex=" + response.getErrorIndex() + ", " + "errorStatus=" + response.getErrorStatusText() + "(" + response.getErrorStatus() + ")"); printVariableBindings(response);
", errorIndex=" + response.getErrorIndex() + ", " + "errorStatus=" + response.getErrorStatusText() + "(" + response.getErrorStatus() + ")"); printVariableBindings(response); ", errorIndex=" + response.getErrorIndex() + ", " + "errorStatus=" + response.getErrorStatusText() + "(" + response.getErrorStatus() + ")"); printVariableBindings(response);
bodyMsg = JsonUtils.jsonKeyValue(ERRSTR, rsuResponse.getResponse().getErrorStatusText());
int index = response.getErrorIndex() - 1; VariableBinding vb = response.get(index); logger.warn(response.getErrorStatusText() + " on " + vb.getOid().toString());
response = snmp.get(pdu, comtarget); if (response != null) { if (response.getResponse().getErrorStatusText().equalsIgnoreCase("Success")) { PDU pduresponse = response.getResponse(); strResponse = pduresponse.getVariableBindings().firstElement().toString();
int errorStatus = responsePDU.getErrorStatus(); int errorIndex = responsePDU.getErrorIndex(); String errorStatusText = responsePDU.getErrorStatusText();
int errorStatus = responsePDU.getErrorStatus(); int errorIndex = responsePDU.getErrorIndex(); String errorStatusText = responsePDU.getErrorStatusText();
private void processResponse(final PDU response) throws SnmpException { try { LOG.debug("Received a tracker PDU of type {} from {} of size {}, errorStatus = {}, errorStatusText = {}, errorIndex = {}", PDU.getTypeString(response.getType()), getAddress(), response.size(), response.getErrorStatus(), response.getErrorStatusText(), response.getErrorIndex()); if (response.getType() == PDU.REPORT) { handleAuthError("A REPORT PDU was returned from the agent. This is most likely an authentication problem. Please check the config"); } else { if (!processErrors(response.getErrorStatus(), response.getErrorIndex())) { if (response.size() == 0) { // NMS-6484 handleError("A PDU with no errors and 0 varbinds was returned from the agent at " + getAddress() + ". This seems to be related with a broken SNMP agent."); } else { for (int i = 0; i < response.size(); i++) { final VariableBinding vb = response.get(i); final SnmpObjId receivedOid = SnmpObjId.get(vb.getOid().getValue()); final SnmpValue val = new Snmp4JValue(vb.getVariable()); Snmp4JWalker.this.processResponse(receivedOid, val); } } } buildAndSendNextPdu(); } } catch (final RuntimeException|SnmpException e) { handleFatalError(e); } }
private void processResponse(final PDU response) throws SnmpException { try { LOG.debug("Received a tracker PDU of type {} from {} of size {}, errorStatus = {}, errorStatusText = {}, errorIndex = {}", PDU.getTypeString(response.getType()), getAddress(), response.size(), response.getErrorStatus(), response.getErrorStatusText(), response.getErrorIndex()); if (response.getType() == PDU.REPORT) { handleAuthError("A REPORT PDU was returned from the agent. This is most likely an authentication problem. Please check the config"); } else { if (!processErrors(response.getErrorStatus(), response.getErrorIndex())) { if (response.size() == 0) { // NMS-6484 handleError("A PDU with no errors and 0 varbinds was returned from the agent at " + getAddress() + ". This seems to be related with a broken SNMP agent."); } else { for (int i = 0; i < response.size(); i++) { final VariableBinding vb = response.get(i); final SnmpObjId receivedOid = SnmpObjId.get(vb.getOid().getValue()); final SnmpValue val = new Snmp4JValue(vb.getVariable()); Snmp4JWalker.this.processResponse(receivedOid, val); } } } buildAndSendNextPdu(); } } catch (final RuntimeException|SnmpException e) { handleFatalError(e); } }
private void processResponse(PDU response) { try { if (log().isDebugEnabled()) { log().debug("Received a tracker PDU of type "+PDU.getTypeString(response.getType())+" from "+getAddress()+" of size "+response.size()+", errorStatus = "+response.getErrorStatus()+", errorStatusText = "+response.getErrorStatusText()+", errorIndex = "+response.getErrorIndex()); } if (response.getType() == PDU.REPORT) { handleAuthError("A REPORT PDU was returned from the agent. This is most likely an authentication problem. Please check the config"); } else { if (!processErrors(response.getErrorStatus(), response.getErrorIndex())) { for (int i = 0; i < response.size(); i++) { VariableBinding vb = response.get(i); SnmpObjId receivedOid = SnmpObjId.get(vb.getOid().getValue()); SnmpValue val = new Snmp4JValue(vb.getVariable()); Snmp4JWalker.this.processResponse(receivedOid, val); } } buildAndSendNextPdu(); } } catch (Throwable e) { handleFatalError(e); } }
@Override public void undo(SubRequest request) { VariableBinding vb = (VariableBinding) request.getUndoValue(); if (vb != null) { Target target = targetMIB.getTarget(targetName, contextEngineID, contextName); PDU pdu = pduFactory.createPDU(target); pdu.setType(PDU.SET); pdu.add(vb); try { ResponseEvent resp = session.send(pdu, target); if (resp.getResponse() != null) { PDU rpdu = resp.getResponse(); if (rpdu.getErrorStatus() != PDU.noError) { request.setErrorStatus(PDU.undoFailed); logger.warn("Undo failed because target '"+target+"' returned error "+rpdu.getErrorStatusText()); } } else { request.setErrorStatus(PDU.genErr); } } catch (IOException e) { request.setErrorStatus(PDU.genErr); logger.error("IOException in undo SET sub-request " + request + " to " + target, e); } } else if (undoEnabled) { request.setErrorStatus(PDU.undoFailed); } request.getStatus().setPhaseComplete(true); }
processSession.getProvenanceReporter().send(flowFile, this.snmpTarget.getAddress().toString()); } else { final String error = response.getResponse().getErrorStatusText(); flowFile = SNMPUtils.addAttribute(SNMPUtils.SNMP_PROP_PREFIX + "error", error, flowFile, processSession); processSession.transfer(processSession.penalize(flowFile), REL_FAILURE);