@Override
    protected void doHealthCheck(final Health.Builder builder) {
        val runtime = Runtime.getRuntime();
        val totalMemory = runtime.totalMemory();
        val freeMemory = runtime.freeMemory();
        val usedMemory = totalMemory - freeMemory;
        val maxMemory = runtime.maxMemory();
        val availableMemory = maxMemory - usedMemory;
        val availableMemoryPercentage = (double) availableMemory * PERCENTAGE_VALUE / maxMemory;
        val freeMemoryPercentage = String.format("%.2f%%", availableMemoryPercentage);
        builder
            .withDetail("availableMemory", FileUtils.byteCountToDisplaySize(availableMemory))
            .withDetail("maxMemory", FileUtils.byteCountToDisplaySize(maxMemory))
            .withDetail("usedMemory", FileUtils.byteCountToDisplaySize(usedMemory))
            .withDetail("totalMemory", FileUtils.byteCountToDisplaySize(totalMemory))
            .withDetail("freeMemory", FileUtils.byteCountToDisplaySize(freeMemory))
            .withDetail("freeMemoryPercentage", freeMemoryPercentage)
            .status(availableMemoryPercentage < freeMemoryWarnThreshold ? Status.DOWN : Status.UP);
    }
Percent free memory below which a warning is reported.
core/cas-server-core-monitor/src/main/java/org/apereo/cas/monitor/MemoryMonitorHealthIndicator.java