HistoricalMetrics { @JsonIgnore public HostMetricsDto getHostMetrics() { HostMetricsDto result = new HostMetricsDto(); try { HostMetricsDto.HostType hostType = getHostType(); result.setType( hostType ); splitSeries(); result.setCpu( getCpuDto( seriesMap.get( SeriesBatch.SeriesType.CPU ) ) ); result.setMemory( getMemoryDto( seriesMap.get( SeriesBatch.SeriesType.MEMORY ) ) ); result.setDisk( getDiskDto( seriesMap.get( SeriesBatch.SeriesType.DISK ) ) ); result.setNet( getNetDto( seriesMap.get( SeriesBatch.SeriesType.NET ) ) ); } catch ( Exception e ) { LOG.error( "Error parsing metric: {}", e.getMessage() ); } return result; } HistoricalMetrics();  HistoricalMetrics( @JsonProperty( "startTime" ) final Date startTime,
                              @JsonProperty( "endTime" ) final Date endTime,
                              @JsonProperty( "Metrics" ) final List<SeriesBatch> metrics );  HistoricalMetrics( final Date startTime, final Date endTime ); Date getStartTime(); void setStartTime( final Date startTime ); Date getEndTime(); void setEndTime( final Date endTime ); @JsonIgnore List<SeriesBatch> getMetrics(); Map<SeriesBatch.SeriesType, List<Series>> getSeriesMap(); double getContainerDiskUsed(); @JsonIgnore HostMetricsDto getHostMetrics(); static boolean isZeroMetric( HostMetricsDto hostMetricsDto );  }
@Test public void testCpu() { final HostMetricsDto metrics = rhMetrics.getHostMetrics(); CpuDto cpuDto = metrics.getCpu(); assertNotNull( cpuDto ); assertEquals( 0.9345833333, cpuDto.getSystem(), 0.0001 ); assertEquals( 3.005, cpuDto.getUser(), 0.0001 ); assertEquals( 0.0, cpuDto.getNice(), 0.0001 ); assertEquals( 95.26708333333335, cpuDto.getIdle(), 0.0001 ); assertEquals( 0.04125000000000002, cpuDto.getIowait(), 0.0001 ); }
@Test public void testMemory() { final HostMetricsDto metrics = rhMetrics.getHostMetrics(); MemoryDto memoryDto = metrics.getMemory(); assertNotNull( memoryDto ); assertEquals( 1440642129.26984, memoryDto.getActive(), 0.0001 ); assertEquals( 6414672749.71429, memoryDto.getMemFree(), 0.0001 ); assertEquals( 905762913.52381, memoryDto.getCached(), 0.0001 ); assertEquals( 17029022.4761905, memoryDto.getBuffers(), 0.0001 ); }
@Test public void testDisk() { final HostMetricsDto metrics = rhMetrics.getHostMetrics(); Map<String, DiskDto> disk = metrics.getDisk(); assertNotNull( disk ); assertEquals( 5, disk.keySet().size() ); DiskDto root = disk.get( "/" ); double available = root.getAvailable(); assertEquals( 3.00056576E8, available, 0.0001 ); double total = root.getTotal(); assertEquals( 1.02330368E9, total, 0.0001 ); double used = root.getUsed(); assertEquals( 6.52783616E8, used, 0.0001 ); }