I'm monitoring docker containers via Prometheus.io. My problem is that I'm just getting cpu_user_seconds_total
or cpu_system_seconds_total
.
How to convert this ever-increasing value to a CPU percentage?
Currently I'm querying:
rate(container_cpu_user_seconds_total[30s])
But I don't think that it is quite correct (comparing to top).
How to convert cpu_user_seconds_total
to CPU percentage? (Like in top)
1 second every second on 1 core will be 100%. 3 cores at 50% will be 1.5 seconds every second, etc...
With every PythonAnywhere account, you get a number of CPU-seconds included each day. This applies to all code run through our in-browser consoles, and in your scheduled tasks. It does not currently apply to your web apps. A CPU-second is one second of full-power usage on a server-grade CPU.
Rate returns a per second value, so multiplying by 100 will give a percentage:
rate(container_cpu_user_seconds_total[30s]) * 100
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With