Package org.ngrinder.monitor.controller.model

Examples of org.ngrinder.monitor.controller.model.SystemDataModel


public class MonitorCollectorTest {

  @Test
  public void testMonitor() {
    SystemDataModel systemDataModel = new SystemDataModel();
    systemDataModel.setCollectTime(100L);
    systemDataModel.setFreeMemory(20L);
    systemDataModel.setCpuUsedPercentage(20f);
    List<SystemDataModel> lists = Lists.newArrayList();
    lists.add(systemDataModel);
    lists.add(systemDataModel);
    Gson gson = new Gson();
    String json = gson.toJson(lists);
View Full Code Here


      SystemInfo info = client.getSystemInfo();
      if (info == null) {
        return;
      }
      info.setCustomValues(random.nextInt() + "," + random.nextInt());
      SystemDataModel data1 = new SystemDataModel(info, "3.1.2");
      rtnMap.put("test-" + random.nextInt(), data1);
      ThreadUtils.sleep(100);
    }
    String statusString = perfTestService.getProperSizedStatusString(rtnMap);
    System.out.println("Status string size is:" + statusString.length());
View Full Code Here

   * (java.lang.String, java.lang.String)
   */
  @Override
  public SystemDataModel getSystemDataModel(String ip, String name) {
    AgentControllerIdentityImplementation agentIdentity = getAgentIdentityByIpAndName(ip, name);
    return agentIdentity != null ? getAgentManager().getSystemDataModel(agentIdentity) : new SystemDataModel();
  }
View Full Code Here

      Map<String, SystemDataModel> systemInfoMap = newHashMap();
      for (MonitorClientService each : this.clientMap.keySet()) {
        each.update();
        final SystemInfo systemInfo = each.getSystemInfo();
        if (systemInfo.isParsed()) {
          systemInfoMap.put(each.getIp(), new SystemDataModel(systemInfo, "UNKNOWN"));
        }
      }
      perfTestService.updateMonitorStat(perfTestId, systemInfoMap);
    }
  }
View Full Code Here

  }

  @Override
  public void run() {
    for (AgentStatus agentStates : agentManager.getAgentStatusSetConnectingToPort(singleConsole.getConsolePort())) {
      SystemDataModel systemDataModel = agentStates.getSystemDataModel();
      if (systemDataModel != null) {
        // If the memory is available less than 2%.
        double freeMemoryRatio = ((double) systemDataModel.getFreeMemory()) / systemDataModel.getTotalMemory();
        if (freeMemoryRatio < 0.02) {
          if (perfTest.getStatus() != Status.ABNORMAL_TESTING) {
            perfTestService.markStatusAndProgress(perfTest, Status.ABNORMAL_TESTING, //
                String.format("[ERROR] %s agent is about to die due to lack of free memory.\n"
                    + "Shutdown PerfTest %s by force for safety\n" + "Please decrease the vuser count.", //
View Full Code Here

   * @return {@link SystemDataModel} instance
   */
  public SystemDataModel getSystemDataModel() {
    try {
      SystemInfo systemInfo = agentSystemDataCollector.execute();
      return new SystemDataModel(systemInfo, this.version);
    } catch (Exception e) {
      LOGGER.error("Error while getting system data model : {} ", e.getMessage());
      LOGGER.debug("The error detail is ", e);
      return emptySystemDataModel;
    }
View Full Code Here

      public SystemInfo call() {
        return monitorInfoStore.getSystemInfo(ip, getConfig().getMonitorPort());
      }
    });
    SystemInfo systemInfo = checkNotNull(submit.get(2, TimeUnit.SECONDS), "Monitoring data is not available.");
    return toJsonHttpEntity(new SystemDataModel(systemInfo, "UNKNOWN"));
  }
View Full Code Here

   */
  @Override
  public SystemDataModel getSystemDataModel(String ip, String name) {
    AgentInfo found = agentManagerRepository.findByIpAndHostName(ip, name);
    String systemStat = (found == null) ? null : found.getSystemStat();
    return (StringUtils.isEmpty(systemStat)) ? new SystemDataModel() : gson.fromJson(systemStat,
        SystemDataModel.class);
  }
View Full Code Here

TOP

Related Classes of org.ngrinder.monitor.controller.model.SystemDataModel

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.