Examples of PDU


Examples of org.snmp4j.PDU

        return values;
    }

    public boolean ping() {
        PDU response;
        try {
            PDU pdu = createPDU(PING_OID, PDU.GETNEXT);
            response = sendRequest(pdu, PING_MIB_NAME);
        } catch (SNMPException e) {
            if (e instanceof SNMPTimeoutException) {
                long timeoutMillis = target.getTimeout() * (target.getRetries() + 1);
                log.debug("Timed out after " + timeoutMillis + " while pinging " + this.version + " agent at " + this
View Full Code Here

Examples of org.snmp4j.PDU

    public String toString() {
        return target.getAddress() + "/" + this.target.getCommunity();
    }

    protected PDU createPDU(String mibName, int type) throws MIBLookupException {
        PDU pdu = new DefaultPDUFactory().createPDU(this.target);
        pdu.setType(type);
        OID oid = SNMPClient.getMibOID(mibName);
        pdu.add(new VariableBinding(oid));
        return pdu;
    }
View Full Code Here

Examples of org.snmp4j.PDU

        return session;
    }

    private SNMPValue getValue(String mibName, int pduType) throws SNMPException {
        PDU request = createPDU(mibName, pduType);
        PDU response = sendRequest(request, mibName);
        return new SNMPValue(response.get(GETBULK_NON_REPEATERS));
    }
View Full Code Here

Examples of org.snmp4j.PDU

        if (responseEvent == null) {
            throw new SNMPException("No response to " + requestType + " request for [" + mibName + "].");
        }

        PDU response = responseEvent.getResponse();
        if (response == null) {
            throw new SNMPTimeoutException(requestType + " request for [" + mibName + "] timed out.");
        }

        return response;
View Full Code Here

Examples of org.snmp4j.PDU

       
        super.doStop();
    }

    public void processPdu(CommandResponderEvent event) {
        PDU pdu = event.getPDU();
        // check PDU not null
        if (pdu != null) {
            processPDU(pdu);
        } else {
            LOG.debug("Received invalid trap PDU: " + pdu);
View Full Code Here

Examples of org.snmp4j.PDU

        target.setRetries(this.endpoint.getRetries());
        target.setTimeout(this.endpoint.getTimeout());
        target.setVersion(this.endpoint.getSnmpVersion());

        // creating PDU
        this.pdu = new PDU();

        // listen to the transport
        if (LOG.isDebugEnabled()) {
            LOG.debug("Starting OID poller on " + endpoint.getAddress() + " using " + endpoint.getProtocol() + " protocol");
        }
View Full Code Here

Examples of org.snmp4j.PDU

            // ignore null requests/responses
            LOG.debug("Received invalid SNMP event. Request: " + event.getRequest() + " / Response: " + event.getResponse());
            return;
        }
       
        PDU pdu = event.getResponse();
        processPDU(pdu);
    }
View Full Code Here

Examples of org.snmp4j.PDU

    securityName.decodeBER(wholeMsg);
    securityLevel.setValue(SecurityLevel.NOAUTH_NOPRIV);
    securityModel.setValue(SecurityModel.SECURITY_MODEL_SNMPv1);
    messageProcessingModel.setValue(ID);

    PDU v1PDU = incomingPDUFactory.createPDU(null);
    pdu.setPdu(v1PDU);
    v1PDU.decodeBER(wholeMsg);

    BER.checkSequenceLength(length, (int)wholeMsg.getPosition() - startPos,
                            v1PDU);

    sendPduHandle.setTransactionID(v1PDU.getRequestID().getValue());

    // create state reference
    StateReference stateRef =
        new StateReference(sendPduHandle,
                           transportAddress,
View Full Code Here

Examples of org.snmp4j.PDU

    securityName.decodeBER(wholeMsg);
    securityLevel.setValue(SecurityLevel.NOAUTH_NOPRIV);
    securityModel.setValue(SecurityModel.SECURITY_MODEL_SNMPv2c);
    messageProcessingModel.setValue(ID);

    PDU v2cPDU = incomingPDUFactory.createPDU(null);
    pdu.setPdu(v2cPDU);
    v2cPDU.decodeBER(wholeMsg);

    BER.checkSequenceLength(length,
                            (int)wholeMsg.getPosition() - startPos,
                            v2cPDU);

    sendPduHandle.setTransactionID(v2cPDU.getRequestID().getValue());

    // create state reference
    StateReference stateRef =
        new StateReference(sendPduHandle,
                           transportAddress,
View Full Code Here

Examples of org.snmp4j.PDU

      if (pduType == null) {
        pduType = "GET";
      }
      pduType = pduType.toUpperCase();
      int type = PDU.getTypeFromString(pduType);
      PDU pdu = DefaultPDUFactory.createPDU(target, type);
      if ((type == PDU.V1TRAP&& (!(pdu instanceof PDUv1))) {
        throw new RuntimeException("V1TRAP can only be sent using SNMPv1");
      }
      if (type == PDU.GETBULK) {
        Integer maxRep = getMaxRepetitions();
        if (maxRep != null) {
          pdu.setMaxRepetitions(maxRep.intValue());
        }
        Integer nonRepeaters = getNonRepeaters();
        if (nonRepeaters != null) {
          pdu.setNonRepeaters(nonRepeaters.intValue());
        }
      }
      else if ((type == PDU.TRAP) || (type == PDU.INFORM)) {
        Number tu = (Number) ArgumentParser.getValue(settings, oTrapSysUpTime, 0);
        if (tu != null) {
          pdu.add(new VariableBinding(SnmpConstants.sysUpTime,
                                      new TimeTicks(tu.longValue())));
        }
        String to = (String) ArgumentParser.getValue(settings, oTrapOID, 0);
        if (to != null) {
          pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(to)));
        }
      }
      else if (type == PDU.V1TRAP) {
        PDUv1 pduV1 = (PDUv1)pdu;
        String aa =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.