org.snmp4j.PDU.getErrorStatusText()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中org.snmp4j.PDU.getErrorStatusText()方法的一些代码示例,展示了PDU.getErrorStatusText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.getErrorStatusText()方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:getErrorStatusText

PDU.getErrorStatusText介绍

[英]Gets a textual description of the error status.
[中]获取错误状态的文本描述。

代码示例

代码示例来源:origin: apache/nifi

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);

代码示例来源:origin: org.snmp4j/snmp4j

/**
 * 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();
}

代码示例来源:origin: org.kaazing/snmp4j

/**
 * 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();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

/**
 * 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();
}

代码示例来源:origin: usdot-jpo-ode/jpo-ode

curRsuMessage = "Deposit successful";
} else {
  curRsuMessage = "Deposit failed: " + response.getResponse().getErrorStatusText();

代码示例来源:origin: usdot-jpo-ode/jpo-ode

+ rsuResponse.getResponse().getErrorStatusText();
+ rsuResponse.getResponse().getErrorStatus() + " " + rsuResponse.getResponse().getErrorStatusText());

代码示例来源:origin: org.snmp4j/snmp4j

", errorIndex=" +
    response.getErrorIndex() + ", " +
    "errorStatus=" + response.getErrorStatusText() +
    "(" + response.getErrorStatus() + ")");
printVariableBindings(response);
    ", errorIndex=" +
    response.getErrorIndex() + ", " +
    "errorStatus=" + response.getErrorStatusText() +
    "(" + response.getErrorStatus() + ")");
printVariableBindings(response);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

", errorIndex=" +
          response.getErrorIndex() + ", " +
          "errorStatus=" + response.getErrorStatusText() +
          "(" + response.getErrorStatus() + ")");
printVariableBindings(response);
          ", errorIndex=" +
          response.getErrorIndex() + ", " +
          "errorStatus=" + response.getErrorStatusText() +
          "(" + response.getErrorStatus() + ")");
printVariableBindings(response);

代码示例来源:origin: org.kaazing/snmp4j

", errorIndex=" +
          response.getErrorIndex() + ", " +
          "errorStatus=" + response.getErrorStatusText() +
          "(" + response.getErrorStatus() + ")");
printVariableBindings(response);
          ", errorIndex=" +
          response.getErrorIndex() + ", " +
          "errorStatus=" + response.getErrorStatusText() +
          "(" + response.getErrorStatus() + ")");
printVariableBindings(response);

代码示例来源:origin: usdot-jpo-ode/jpo-ode

bodyMsg = JsonUtils.jsonKeyValue(ERRSTR, rsuResponse.getResponse().getErrorStatusText());

代码示例来源:origin: fbacchella/jrds

int index = response.getErrorIndex() - 1;
VariableBinding vb = response.get(index);
logger.warn(response.getErrorStatusText() + " on " + vb.getOid().toString());

代码示例来源:origin: org.opendaylight.cardinal/cardinal-impl

response = snmp.get(pdu, comtarget);
if (response != null) {
  if (response.getResponse().getErrorStatusText().equalsIgnoreCase("Success")) {
    PDU pduresponse = response.getResponse();
    strResponse = pduresponse.getVariableBindings().firstElement().toString();

代码示例来源:origin: org.opendaylight.cardinal/cardinal-impl

int errorStatus = responsePDU.getErrorStatus();
int errorIndex = responsePDU.getErrorIndex();
String errorStatusText = responsePDU.getErrorStatusText();

代码示例来源:origin: org.opendaylight.cardinal/cardinal-impl

int errorStatus = responsePDU.getErrorStatus();
int errorIndex = responsePDU.getErrorIndex();
String errorStatusText = responsePDU.getErrorStatusText();

代码示例来源:origin: OpenNMS/opennms

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);
  }
}

代码示例来源:origin: org.opennms.core.snmp/org.opennms.core.snmp.implementations.snmp4j

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);
  }
}

代码示例来源:origin: org.opennms.lib.snmp/org.opennms.lib.snmp.snmp4j

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);
  }
}

代码示例来源:origin: org.snmp4j/snmp4j-agent

@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);
}

代码示例来源:origin: org.apache.nifi/nifi-snmp-processors

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);

相关文章