Hi, I noticed that balena has cpu usage offered
I need to use that variable to report to another place, how can we access it from inside a container?
To be clear I want the CPU usage of all processes from all containers
Thank you in advanced
Hi there, that information is not available via the supervisor API yet. We are planning to include it as part of a future release but we don’t have an ETA on that feature yet. You could get it from the balenaCloud API, but I wouldn’t recommend it as the information on the cloud side is heavily throttled to prevent too much bandwidth usage and the overloading of the API. Your best bet would be to get that information programmatically using something like the systeminformation NPM module or some other utility that makes sense for your stack language.
Could you tell us more about your use case? What sort of feature are you building that requires that information?
OK, thank you.
I wanted to monitor our CPU usage and since the balena seems to be doing it anyway, I thought it would be useful not to calculate twice.
The reason we need it is because some of our exe can’t function if the usage is too high, there is no room for them to work so we would like to have a priority system if the usage is too high (around the 80%)
But if there is no way to access it yet, we will calculate it in our code
Hi there,
In this case, I would recommend calculating it in your code, using a module like the one Felipe described.
Thanks