Examples of SnmpPeer


Examples of com.sun.jmx.snmp.SnmpPeer

        while(iterator.hasNext()) {
            NotificationTarget target = null;
            try {
                target = (NotificationTarget) iterator.next();
                SnmpPeer peer =
                    new SnmpPeer(target.getAddress(), target.getPort());
                SnmpParameters p = new SnmpParameters();
                p.setRdCommunity(target.getCommunity());
                peer.setParams(p);
                log.debug("handleNotification", "Sending trap to " +
                          target.getAddress() + ":" + target.getPort());
                adaptor.snmpV2Trap(peer, trap, list, null);
            }catch(Exception e) {
                log.error("sendTrap",
View Full Code Here

Examples of com.sun.management.snmp.manager.SnmpPeer

          session = new SnmpSession("Set V" + version + " session");

          // Create an SnmpPeer object for representing the entity
          // to communicate with.
          //
          final SnmpPeer agent = new SnmpPeer(remoteHost, port);

          // Specify the read and write community to be used
          //
          final SnmpParameters params = new SnmpParameters(
                  community,
                  community);

          // Specify the protocol version
          //
          switch (version) {
            case 1:
              params.setProtocolVersion(SnmpDefinitions.snmpVersionOne);
              break;
            case 2:
              params.setProtocolVersion(SnmpDefinitions.snmpVersionTwo);
              break;
            default:
              break;
          }

          // Associate the parameters with the agent
          //
          agent.setTimeout(timeOut);
          agent.setMaxTries(maxRetries);
          agent.setParams(params);

          // Set the default peer (agent) to a SnmpSession
          //
          session.setDefaultPeer(agent);
          break;
View Full Code Here

Examples of com.sun.management.snmp.manager.SnmpPeer

          session.snmpOptions.setPduFixedOnError(false);

          // Create an SnmpPeer object for representing the entity
          // to communicate with.
          //
          final SnmpPeer agent = new SnmpPeer(remoteHost, port);

          // Specify the read and write community to be used
          //
          final SnmpParameters params = new SnmpParameters(
                  community,
                  community);

          // Specify the protocol version
          //
          switch (version) {
            case 1:
              params.setProtocolVersion(SnmpDefinitions.snmpVersionOne);
              break;
            case 2:
              params.setProtocolVersion(SnmpDefinitions.snmpVersionTwo);
              break;
          }

          // Associate the parameters with the agent
          //
          agent.setTimeout(timeOut);
          agent.setMaxTries(maxRetries);
          agent.setParams(params);

          // Set the default peer (agent) to a SnmpSession
          //
          session.setDefaultPeer(agent);
          break;
View Full Code Here

Examples of com.sun.management.snmp.manager.SnmpPeer

    @Test(enabled=false,dataProvider = "listAttributes")
    public void checkAttribute(String attributeName) {

        // get the SNMP peer agent
        SnmpPeer agent = this.getSnmpV2Peer(this.getSnmpPort());
        assertNotNull(agent);

        // Create parameters to associate to the entity to communicate
        // with.
        // When creating the parameter object, you can specify the read
        // and write community to be used when querying the agent.

        final SnmpParameters params =
                new SnmpParameters();

        // Set to the allowed the community string
        params.setRdCommunity("NasuTekDS@NasuTekDS");

        // The newly created parameter must be associated to the agent.
        //
        agent.setParams(params);

        // Build the session. A session creates, controls and
        // manages one or more requests.
        //
        try {
View Full Code Here

Examples of com.sun.management.snmp.manager.SnmpPeer

            //

            // Create a SnmpPeer object for representing the entity to
            // communicate with.
            //
            final SnmpPeer agent =
                    new SnmpPeer(host, this.getSnmpPort());

            // Create parameters to associate to the entity to communicate
            // with.
            // When creating the parameter object, you can specify the read
            // and write community to be used when querying the agent.
            //
            final SnmpParameters params =
                    new SnmpParameters();
            params.setRdCommunity(community);

            // The newly created parameter must be associated to the agent.
            //
            agent.setParams(params);

            // Build the session. A session creates, controls and
            // manages one or more requests.
            //
            final SnmpSession session =
View Full Code Here

Examples of com.sun.management.snmp.manager.SnmpPeer

    try
    {
      String host = InetAddress.getLocalHost().getCanonicalHostName();
      SnmpOidTableSupport oidTable = new DIRECTORY_SERVER_MIBOidTable();
      SnmpOid.setSnmpOidTable(oidTable);
      return new SnmpPeer(host, port);
    }
    catch (Exception ex)
    {
      return null;
    }
View Full Code Here

Examples of org.opennms.protocols.snmp.SnmpPeer

       
   public void openSession()
      throws SocketException
   {
      // Create the SNMP session to the manager
      SnmpPeer peer = new SnmpPeer(this.address, this.port, this.localAddress, this.localPort);
      peer.setRetries(this.retries);
      peer.setTimeout(this.timeout);
           
      SnmpParameters parameters = peer.getParameters();
           
      switch(this.version) {               
         case SnmpAgentService.SNMPV1:
            parameters.setVersion(SnmpSMI.SNMPV1);
            break;
        
         case SnmpAgentService.SNMPV2:
            parameters.setVersion(SnmpSMI.SNMPV2);
            break;
         default:
            parameters.setVersion(SnmpSMI.SNMPV1);
      }
           
      parameters.setReadCommunity(this.readCommunity);
      peer.setParameters(parameters);
           
      this.session = new SnmpSession(peer);
      this.session.setDefaultHandler(this);
   }
View Full Code Here

Examples of org.opennms.protocols.snmp.SnmpPeer

      // cater for possible global -b option, if no override has been specified
      InetAddress address = this.bindAddress != null ? this.bindAddress :
            toInetAddress(System.getProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS));
     
      // the listening address
      SnmpPeer peer = new SnmpPeer(address, this.port);
     
      // set community strings and protocol version
      peer.getParameters().setReadCommunity(this.readCommunity);
      peer.getParameters().setWriteCommunity(this.writeCommunity);
      peer.getParameters().setVersion(this.snmpVersion == SNMPV2 ? SnmpSMI.SNMPV2 : SnmpSMI.SNMPV1);
     
      // Instantiate and initialize the RequestHandler implementation
      requestHandler = (RequestHandler)Class.forName(
         this.requestHandlerClassName, true, this.getClass().getClassLoader()).newInstance();
      requestHandler.initialize(this.requestHandlerResName, this.getServer(), this.log, this.clock);
View Full Code Here

Examples of org.opennms.protocols.snmp.SnmpPeer

      // cater for possible global -b option, if no override has been specified
      InetAddress address = this.bindAddress != null ? this.bindAddress :
            toInetAddress(System.getProperty(ServerConfig.SERVER_BIND_ADDRESS));
     
      // the listening address
      SnmpPeer peer = new SnmpPeer(address, this.port);
     
      // set community strings and protocol version
      peer.getParameters().setReadCommunity(this.readCommunity);
      peer.getParameters().setWriteCommunity(this.writeCommunity);
      peer.getParameters().setVersion(this.snmpVersion == SNMPV2 ? SnmpSMI.SNMPV2 : SnmpSMI.SNMPV1);
     
      // Instantiate and initialize the RequestHandler implementation
      requestHandler = (RequestHandler)Class.forName(
         this.requestHandlerClassName, true, this.getClass().getClassLoader()).newInstance();
      requestHandler.initialize(this.requestHandlerResName, this.getServer(), this.log, this.clock);
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.