Examples of ChukwaAgentController


Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

        synchronized (chukwaLock) {
          if (chukwaClient == null) {
            String log4jFileName = getFile();
            String recordType = getRecordType();
            long currentLength = 0L;
            chukwaClient = new ChukwaAgentController();
            chukwaClientIsNull = false;
            String adaptorID = chukwaClient.add(ChukwaAgentController.CharFileTailUTF8NewLineEscaped,
              recordType,currentLength + " " + log4jFileName, currentLength);

            // Setup a shutdownHook for the controller
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

  public ChukwaJobTrackerInstrumentation(JobTracker jt, JobConf conf) {
    super(jt, conf);
    tracker = jt;
    if (chukwaClient == null) {
      chukwaClient = new ChukwaAgentController();
    }
    if (jobHistories == null) {
      jobHistories = new HashMap<JobID, String>();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

      ChukwaAgent.AlreadyRunningException {
    ChukwaAgent agent = new ChukwaAgent();
    // Remove any adaptor left over from previous run
    ChukwaConfiguration cc = new ChukwaConfiguration();
    int portno = cc.getInt("chukwaAgent.control.port", 9093);
    ChukwaAgentController cli = new ChukwaAgentController("localhost", portno);
    cli.removeAll();
    // sleep for some time to make sure we don't get chunk from existing streams
    Thread.sleep(5000);
    File testFile = makeTestFile("chukwaLogRotateTest", 80);
    String adaptorId = agent
        .processAddCommand("add lr =org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.CharFileTailingAdaptorUTF8"
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

          }

          if (chukwaClient == null) {
            if (getChukwaClientHostname() != null
                && getChukwaClientPortNum() != 0) {
              chukwaClient = new ChukwaAgentController(
                  getChukwaClientHostname(), getChukwaClientPortNum());
              log.debug("setup adaptor with hostname "
                  + getChukwaClientHostname() + " and portnum "
                  + getChukwaClientPortNum());
            } else {
              chukwaClient = new ChukwaAgentController();
              log
              .debug("setup adaptor with no args, which means it used its defaults");
            }

            chukwaClientIsNull = false;
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

 
      Thread.sleep(1000);
       
      ChukwaConfiguration cc = new ChukwaConfiguration();
      int portno = cc.getInt("chukwaAgent.control.port", 9093);
      ChukwaAgentController cli = new ChukwaAgentController("localhost", portno);
     
      File tmpOutput = new File("/tmp/chukwaTest");
      FileOutputStream fos = new FileOutputStream(tmpOutput);
      Random r = new Random();
      boolean failed = false;
      byte[] randomData = new byte[2000];
      r.nextBytes(randomData);
      randomData[1999] = '\n';//need data to end with \n since default tailer uses that
      fos.write(randomData);
      fos.flush();
      fos.close();
     
      cli.addFile("unknown", tmpOutput.getAbsolutePath());
      assertEquals(1, agent.adaptorCount());
      cli.removeFile("unknown", tmpOutput.getAbsolutePath());
      assertEquals(0, agent.adaptorCount());
      org.apache.hadoop.chukwa.Chunk readIn = readInData.readOutChunk(randomData.length, 5000);
      byte[] readInBytes = readIn.getData();
      if(readInBytes.length != randomData.length)
      {
        System.err.println("FAIL: input ended at " + readInBytes.length + " bytes");
        failed = true;
      } else {
        for(int i = 0; i < randomData.length ; ++i) {
          byte next = readInBytes[i];
          if(next != randomData[i]) {
            System.err.println("FAIL: saw byte " + next + " at position " + i +
                ", expected " + randomData[i]);
            failed = true;
            break;
          }
        }
      }
      cli.removeAll();
      tmpOutput.delete();
      assertFalse(failed);
      System.out.println("done");
    } catch(Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

 
      Thread.sleep(1000);
      
      ChukwaConfiguration cc = new ChukwaConfiguration();
      int portno = cc.getInt("chukwaAgent.control.port", 9093);
      ChukwaAgentController cli = new ChukwaAgentController("localhost", portno);
     
      for(int i=1; i < STOPS_AND_STARTS; ++i) {
        cli.add("org.apache.hadoop.chukwa.util.ConstRateAdaptor", "oneatatime_raw" + i, "20000", 0);
        assertEquals("adaptor failed to start", 1, agent.adaptorCount());
        Thread.sleep(2000);  
        cli.removeAll();
        assertTrue("adaptor failed to stop", agent.adaptorCount() == 0);
      }
    } catch(Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

      Thread.sleep(1000);

     
      ChukwaConfiguration cc = new ChukwaConfiguration();
      int portno = cc.getInt("chukwaAgent.control.port", 9093);
      ChukwaAgentController cli = new ChukwaAgentController("localhost", portno);
      assertEquals("no adaptors should be running pre-test",0, agent.adaptorCount());
      for(int i=0; i < 10; ++i) {
       
        for(int n = 1; n < 7; ++n) {
//          cli.add("org.apache.hadoop.chukwa.util.ConstRateAdaptor", "many_raw"+n, "20000", 0);
          agent.processCommand("add org.apache.hadoop.chukwa.util.ConstRateAdaptor many_raw"+n + " 20000 0");
          assertEquals(n, agent.adaptorCount());
        }
       
        Thread.sleep(5000);
  
        cli.removeAll();
        assertEquals("remove left some adaptors running", 0, agent.adaptorCount());
      }
  } catch(Exception e) {
    e.printStackTrace();
  }
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

      ConsoleOutConnector conn = new ConsoleOutConnector(agent, true);
      conn.start();
     
      ChukwaConfiguration cc = new ChukwaConfiguration();
      int portno = cc.getInt("chukwaAgent.control.port", 9093);
      ChukwaAgentController cli = new ChukwaAgentController("localhost", portno);
     
      for(int i=1; i < 20; ++i) {
        cli.add("org.apache.hadoop.chukwa.util.ConstRateAdaptor", "raw" + i, "20000", 0);
        assertTrue(agent.adaptorCount() == 1);
        Thread.sleep(2000);  
        cli.removeAll();
        assertTrue(agent.adaptorCount() == 0);
      }
      agent.shutdown();
      conn.shutdown();
    } catch(Exception e) {
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

  //consoleConnector = new ConsoleOutConnector(agent);
 
  protected void setUp() throws ChukwaAgent.AlreadyRunningException {
    config = new ChukwaConfiguration();
    agent = new ChukwaAgent();
    c = new ChukwaAgentController();
    httpConnector = new HttpConnector(agent); //use default source for list of collectors (i.e. conf/connectors)

    httpConnector.start();

//    assertTrue(Integer.parseInt(config.get("chukwaAgent.control.port")) == agent.getControlSock().getPortNumber());
View Full Code Here

Examples of org.apache.hadoop.chukwa.datacollection.controller.ChukwaAgentController

      HttpConnector connector = new HttpConnector(agent, "http://localhost:1234/chukwa");
      connector.start();
     
      ChukwaConfiguration cc = new ChukwaConfiguration();
      int portno = cc.getInt("chukwaAgent.control.port", 9093);
      ChukwaAgentController cli = new ChukwaAgentController("localhost", portno);
     
      File tmpOutput = TempFileUtil.makeBinary(2000);
     
      cli.addFile("unknown", tmpOutput.getAbsolutePath());
      System.out.println("have " + agent.adaptorCount() + " running adaptors");
      cli.removeFile("unknown", tmpOutput.getAbsolutePath());
   
     
      tmpOutput.delete();
      assertFalse(failed);
      System.out.println("done");
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.