예제 #1
0
 public static void populateCpuUtilizationHosts(Utilization utilization, DataSource dwhDataSource)
     throws DashboardDataException {
   HostDwhDao dao = new HostDwhDao(dwhDataSource);
   List<TrendResources> resourceUsage = dao.getCpuUtilizationHosts();
   for (TrendResources usage : resourceUsage) {
     UtilizedEntity entity = new UtilizedEntity();
     entity.setName(usage.getName());
     entity.setUsed(usage.getUsed() * usage.getTotal() / 100);
     entity.setTotal(usage.getTotal());
     entity.setTrend(calculateTrend(usage.getUsed(), usage.getPreviousUsed()));
     utilization.addResource(entity);
   }
 }
예제 #2
0
 public static void populateMemoryUtilizationHosts(
     Utilization utilization, DataSource dwhDataSource) throws DashboardDataException {
   HostDwhDao dao = new HostDwhDao(dwhDataSource);
   List<TrendResources> usageList = dao.getMemoryUtilizationHosts();
   for (TrendResources usage : usageList) {
     UtilizedEntity entity = new UtilizedEntity();
     entity.setName(usage.getName());
     // Transform to GB
     entity.setUsed(usage.getUsed() / 1024);
     // Transform to GB
     entity.setTotal(usage.getTotal() / 1024);
     entity.setTrend(calculateTrend(usage.getUsed(), usage.getPreviousUsed()));
     utilization.addResource(entity);
   }
 }