Search in sources :

Example 1 with OsStats

use of org.opensearch.monitor.os.OsStats in project fess by codelibs.

the class SystemMonitorTarget method appendOsStats.

private void appendOsStats(final StringBuilder buf) {
    buf.append("\"os\":{");
    final OsProbe osProbe = OsProbe.getInstance();
    buf.append("\"memory\":{");
    buf.append("\"physical\":{");
    append(buf, "free", () -> osProbe.getFreePhysicalMemorySize()).append(',');
    append(buf, "total", () -> osProbe.getTotalPhysicalMemorySize());
    buf.append("},");
    buf.append("\"swap_space\":{");
    append(buf, "free", () -> osProbe.getFreeSwapSpaceSize()).append(',');
    append(buf, "total", () -> osProbe.getTotalSwapSpaceSize());
    buf.append('}');
    buf.append("},");
    buf.append("\"cpu\":{");
    append(buf, "percent", () -> osProbe.getSystemCpuPercent());
    final OsStats osStats = osProbe.osStats();
    buf.append("},");
    append(buf, "load_averages", () -> osStats.getCpu().getLoadAverage());
    buf.append("},");
}
Also used : OsProbe(org.opensearch.monitor.os.OsProbe) OsStats(org.opensearch.monitor.os.OsStats)

Aggregations

OsProbe (org.opensearch.monitor.os.OsProbe)1 OsStats (org.opensearch.monitor.os.OsStats)1