After [2.4.4] How to retrieve CPU%

This line was included in Release 2.4.4 Available

Perhaps I missed something but how do we use this enhancement provided with 2.4.4. Do we have a endpoint, or is it retrieved somewhere else. I just don't remember seeing it.

I know hubinfo driver from @thebearmay provides a value for it, but i am not sure if is using this new method that is updated on 1 second intervals.

Endpoint didn't change but the frequency of sampling behind it did

1 Like

What endpoint is it. I was trying to figure that out looking at your driver and it looks like it uses the below end point. When I check the endpoint it is still in the load value and not in a %

/hub/advanced/freeOSMemoryLast

So is it still a load value, that is a little confusing based on the change log.

Still a load value I believe

1 Like

That endpoint doesn't seem to refresh its data every second.

The column header from /hub/advanced/freeOSMemoryLast seams to point to CPU usage being a 5min average. Unless the column header name is a bug, this sounds like expected behavior for this endpoint.

Date/time,Free OS,5m CPU avg,Total Java,Free Java,Direct Java
03-26 21:15:38,169036,0.37,331392,82357,7597

I agree.

What i am asking about is what is in the changelog for 2.4.4.129. It mentions something was moved from a load value to a % that is updated every second.

I was initially thinking it was a different endpoint.

Maybe @gopher.ny can shed some light.

2 Likes

I believe the one minute endpoint referred to is /hub/cpuInfo. This is the endpoint used in Simple Hub Monitor:

        // cpuInfo is a two line response that looks like this:
        //    Processors 4
        //    Load Average 0.34
        // Load Average is the 1 minute load average

Of course, there could be yet another endpoint that I am completely unaware of...

:thinking:

1 Like

Believe that one, as well as the 5min ones, all use the same 1 second sampling behind the scenes - just accumulated and averaged over different time periods when reported

I believe that all the values are standard Linux load average values, which by default are calculated every 5 seconds. I doubt Habitat would change that in the kernel, but I could be wrong (again). :slight_smile:

The /hub/cpuInfo actually updates every 5 seconds. Easily tested by just refresh the page every few seconds.

/hub/advanced/freeOSMemoryLast does not. I have a feeling just based on the name it is just the last entry from the endpoing /hub/advanced/freeOSMeoryHistory. That certainly doesn't means pulling the value from their is uselles for less then 5 min intervals

I am trying to look at ways to pull more granular CPU Stats when troubleshooting a problem . A spike that kills the cpu for 3 seconds will be much better represented using 5 second intervals vs a 5 min one. I certainly wouldn't recomend running that frequenccy for long though as that would be it's on load issue.