Package org.snmp4j

Examples of org.snmp4j.CommunityTarget


  }

  /** @see org.chiefly.sunlamp.AbstractSNMP#createVersionSpecificTarget() */
  @Override
  protected Target createVersionSpecificTarget() {
    final CommunityTarget target = new CommunityTarget();
    target.setVersion(SnmpConstants.version2c);
    target.setCommunity(this.community);
    return target;
  }
View Full Code Here


        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

        // Create the SNMP instance
        Snmp snmp = createSnmpConnection();

        // Specify receiver
        Address targetaddress = new UdpAddress(seyrenConfig.getSnmpHost() + "/" + seyrenConfig.getSnmpPort());
        CommunityTarget target = new CommunityTarget();
        target.setCommunity(octetString(seyrenConfig.getSnmpCommunity()));
        target.setVersion(SnmpConstants.version2c);
        target.setAddress(targetaddress);


        for (Alert alert : alerts) {

            // Create PDU          
View Full Code Here

public class SnmpHelper {
    private Snmp _snmp;
    private CommunityTarget _target;

    public SnmpHelper(String address, String community) {
        _target = new CommunityTarget();
        _target.setCommunity(new OctetString(community));
        _target.setVersion(SnmpConstants.version2c);
        _target.setAddress(new UdpAddress(address));
        try {
            _snmp = new Snmp(new DefaultUdpTransportMapping());
View Full Code Here

      transport = new DefaultUdpTransportMapping();
      transport.listen();
    } catch (IOException e) {
    }
    // Create Target Address object
    CommunityTarget comtarget = new CommunityTarget();
    comtarget.setCommunity(new OctetString(Settings.get("snmp.community", "public")));
    comtarget.setVersion(SnmpConstants.version1);
    comtarget.setAddress(new UdpAddress(ipAddress + "/" + Settings.getInt("snmp.port", 161)));
    comtarget.setRetries(2);
    comtarget.setTimeout(1000);
    // Create the PDU object
    // Create Snmp object
    Snmp snmp = new Snmp(transport);
    // Iterating over map
    for (Entry<Object, Object> entry : p.entrySet()) {
View Full Code Here

      SecurityProtocols.getInstance().addDefaultProtocols();
      SecurityProtocols.getInstance().addPrivacyProtocol(new Priv3DES());

      // Create Target
      if (SnmpBinding.community != null) {
        CommunityTarget target = new CommunityTarget();
        target.setCommunity(new OctetString(SnmpBinding.community));
      }

      snmp = new Snmp(transport);

      transport.listen();
View Full Code Here

    }

    logger.debug("SNMP command for {} to {}", itemName, providerCmd.toString());

    // Set up the target
    CommunityTarget target = new CommunityTarget();
      target.setCommunity(providerCmd.getCommunity(itemName, command));
      target.setAddress(providerCmd.getAddress(itemName, command));
      target.setRetries(retries);
      target.setTimeout(timeout);
      target.setVersion(SnmpConstants.version1);

    Variable var = providerCmd.getValue(itemName, command);
    OID oid = providerCmd.getOID(itemName, command);
      VariableBinding varBind = new VariableBinding(oid,var);
View Full Code Here

        if (needsUpdate) {
          logger.debug("Item '{}' is about to be refreshed", itemName);

          // Set up the target
          CommunityTarget target = new CommunityTarget();
            target.setCommunity(provider.getCommunity(itemName));
            target.setAddress(provider.getAddress(itemName));
            target.setRetries(retries);
            target.setTimeout(timeout);
            target.setVersion(SnmpConstants.version1);

          // Create the PDU
          PDU pdu = new PDU();
            pdu.add(new VariableBinding(provider.getOID(itemName)));
            pdu.setType(PDU.GET);
View Full Code Here

TOP

Related Classes of org.snmp4j.CommunityTarget

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.