

What you can do is get the average load for each vCPU during a period of time (mpstat provides that) or the average for all vCPUs combined (vmstat).Įven fully CPU bound, if the hostile CPU consumer is single-threaded, it might not blatantly show up in the latter case because other vCPUs might be idle. There is no such thing as instantaneous 80% busy CPU. Not to mention a single vCPU can only be either 100% idle or 100% busy at any given time. It is then not that simple to define how to compute a CPU load.

Moreover, cores have often variable clock speed. Modern CPUs have multiple cores and often each core supports multiple threads. Check CPU usage, if it is higher than 80% (as example) Do something.
