Package org.snmp4j.smi

Examples of org.snmp4j.smi.OctetString


        LOG.debug("Activating oid poller");
        this.targetAddress = GenericAddress.parse(this.endpoint.getAddress());
        this.transport = new DefaultUdpTransportMapping();
        this.snmp = new Snmp(this.transport);
        this.usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
        SecurityModels.getInstance().addSecurityModel(usm);

        // setting up target
        target = new CommunityTarget();
        target.setCommunity(new OctetString(this.endpoint.getSnmpCommunity()));
        target.setAddress(targetAddress);
        target.setRetries(this.endpoint.getRetries());
        target.setTimeout(this.endpoint.getTimeout());
        target.setVersion(this.endpoint.getSnmpVersion());
View Full Code Here


        this.pdu = pdu;
    }

    public SnmpMessage(PDU pdu, CommandResponderEvent event) {
        this.pdu = pdu;
        this.setHeader("securityName", new OctetString(event.getSecurityName()));
        this.setHeader("peerAddress", event.getPeerAddress());
    }
View Full Code Here

        } else {
            throw new IllegalArgumentException("Unknown protocol: " + endpoint.getProtocol());
        }

        this.snmp = new Snmp(this.transport);
        this.usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
        SecurityModels.getInstance().addSecurityModel(usm);

        // setting up target
        target = new CommunityTarget();
        target.setCommunity(new OctetString(this.endpoint.getSnmpCommunity()));
        target.setAddress(targetAddress);
        target.setRetries(this.endpoint.getRetries());
        target.setTimeout(this.endpoint.getTimeout());
        target.setVersion(this.endpoint.getSnmpVersion());
View Full Code Here

        } else {
            throw new IllegalArgumentException("Unknown protocol: " + endpoint.getProtocol());
        }

        this.snmp = new Snmp(this.transport);
        this.usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
        SecurityModels.getInstance().addSecurityModel(usm);

        // setting up target
        target = new CommunityTarget();
        target.setCommunity(new OctetString(this.endpoint.getSnmpCommunity()));
        target.setAddress(targetAddress);
        target.setRetries(this.endpoint.getRetries());
        target.setTimeout(this.endpoint.getTimeout());
        target.setVersion(this.endpoint.getSnmpVersion());
View Full Code Here

        } else {
            throw new IllegalArgumentException("Unknown protocol: " + endpoint.getProtocol());
        }

        this.snmp = new Snmp(this.transport);
        this.usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
        SecurityModels.getInstance().addSecurityModel(usm);

        // setting up target
        target = new CommunityTarget();
        target.setCommunity(new OctetString(this.endpoint.getSnmpCommunity()));
        target.setAddress(targetAddress);
        target.setRetries(this.endpoint.getRetries());
        target.setTimeout(this.endpoint.getTimeout());
        target.setVersion(this.endpoint.getSnmpVersion());
View Full Code Here

    address= address + "/" + port;
    Address targetAddress = GenericAddress.parse(address);
    logger.info("sendig trap to: " + address + ", message: " + message);
   
    CommunityTarget target = new CommunityTarget();
    target.setCommunity(new OctetString(community));
    target.setAddress(targetAddress);
   
    PDUv1 pdu = new PDUv1();
    pdu.setType(PDU.V1TRAP);
    VariableBinding vb = new VariableBinding();
    OID oidMessage = new OID (alarmMessageOid);
    vb.setOid(oidMessage);
    if(message.length() < MAX_ALARM_MESSAGE_SIZE) {
      vb.setVariable(new OctetString(message));
    } else {
      String tmpMessage = message.substring(0,MAX_ALARM_MESSAGE_SIZE);
      logger.info(" message too long " + message  +
          ". send " + tmpMessage);
      vb.setVariable(new OctetString(tmpMessage));
    }
    pdu.add(vb);   
    OID oid  = new OID(trapId);
    if(trapType == CRITICAL_TRAP) {
      pdu.setSpecificTrap(CRITICAL_TRAP);
View Full Code Here

   
    try {
      TransportMapping transport = new DefaultUdpTransportMapping();
      snmp = new Snmp(transport);
      CommunityTarget target = new CommunityTarget();
      target.setCommunity(new OctetString(community));
      target.setAddress(targetAddress);
      target.setRetries(0);
      target.setTimeout(200);
      target.setVersion(SnmpConstants.version2c);
      PDU pdu = new PDU();
View Full Code Here

    try {
      Address targetaddress = new UdpAddress(address);
      TransportMapping transport = new DefaultUdpTransportMapping();
      transport.listen();
      CommunityTarget comtarget = new CommunityTarget();
      comtarget.setCommunity(new OctetString(community));
      comtarget.setVersion(SnmpConstants.version1);
      comtarget.setAddress(targetaddress);
      comtarget.setRetries(2);
      comtarget.setTimeout(5000);
      PDU pdu = new PDU();
View Full Code Here

    snmp = new Snmp(dispatcher, transport);
    snmp.getMessageDispatcher().addMessageProcessingModel(new MPv1());
    snmp.getMessageDispatcher().addMessageProcessingModel(new MPv2c());
    snmp.getMessageDispatcher().addMessageProcessingModel(new MPv3());
    USM usm = new USM(SecurityProtocols.getInstance(),
                      new OctetString(MPv3.createLocalEngineID()), 0);
    SecurityModels.getInstance().addSecurityModel(usm);
    snmp.listen();
  }
View Full Code Here

    super(transportMapping, retries, timeout, reportHandler);

    this.user = Preconditions.checkNotNull(usmUser);

    final USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
    SecurityModels.getInstance().addSecurityModel(usm);
    this.getSnmp().getUSM().addUser(usmUser);
  }
View Full Code Here

TOP

Related Classes of org.snmp4j.smi.OctetString

Copyright © 2018 www.massapicom. 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.