Spring Boot Actuator to Give CPU Usage

user2340345 picture user2340345 · Jun 23, 2016 · Viewed 8k times · Source

I would like to know is there a way to get the CPU Usage metrics with Spring Boot Actuator? Im able to see other metrics with /metrics and /health endpoints but not getting the CPU Usage. I want to avoid writing an extra class just to see the CPU Usage. Any idea? Thanks

Answer

Jose Martinez picture Jose Martinez · Feb 11, 2020

Just checked and I found this actuator... /actuator/metrics/process.cpu.usage

It outputs the following:

{
    name: "process.cpu.usage",
    description: "The "recent cpu usage" for the Java Virtual Machine process",
    baseUnit: null,
    measurements: [
        {
            statistic: "VALUE",
            value: 0.0001742149747252696
        }
    ],
    availableTags: [ ]
}

Currently using Spring Boot version 2.2.2.RELEASE.