This might be of some help, in the sense of how CPU usage is calculated. It seems to be accurate from the testing I have done, but I don't claim to be a professional programmer or have covered all test cases.
https://gist.github.com/microlinux/0b3f47cb657cb61bb89b On Tue, Jul 22, 2014 at 12:30 AM, Pavel Odintsov <pavel.odint...@gmail.com> wrote: > It's really nice idea for building CPU load graphics from HWN side. > Anybody have any ideas do it without vzctl exec... ? > > On Mon, Jul 21, 2014 at 10:53 PM, Todd Mueller <toddmuel...@gmail.com> wrote: >> Can you clarify what you are trying to accomplish? Are you trying to >> identify containers using excessive CPU? >> >> On Mon, Jul 21, 2014 at 10:06 AM, Pavel Snajdr <li...@snajpa.net> wrote: >>> Hello, >>> >>> is there any way how to get CPU idle % of CT outside out of the CT? >>> >>> We were trying to figure this out from /proc/vz/vestat, first try was to >>> divide used/idle, but idle seems to be accounted for all available >>> hwnode CPUs and used seems to be accounted for CPUs available to the CT; >>> in the end it was giving a pretty reasonable numbers in low CPU load >>> situations, but when the CT was maxing out its available CPUs, we were >>> getting 100+% CPU load. >>> >>> Next thing we've tried is to look into user,nice and system values, but >>> there is no idle nor total number of available jiffies to compare to. >>> >>> Another thing we've tried is to read /proc/stat from outside of the CT, >>> but that is a problem, since ve->veid is 0 when running a process to >>> read out /vz/root/<veid>/proc/stat. >>> >>> Solution of a last resort seems to be to run mpstat (or equivalent) >>> inside of the CT via vzctl exec and watch its output. But that gives me >>> hundreds of unnecessary running processes - I need to monitor hundreds >>> of CTs per hwnode. That's kind of a pain :) >>> >>> Is there any better way to do this or what am I doing wrong? >>> >>> Our kernel is 042stab092.2. >>> >>> - snajpa >>> _______________________________________________ >>> Users mailing list >>> Users@openvz.org >>> https://lists.openvz.org/mailman/listinfo/users >> _______________________________________________ >> Users mailing list >> Users@openvz.org >> https://lists.openvz.org/mailman/listinfo/users > > > > -- > Sincerely yours, Pavel Odintsov > _______________________________________________ > Users mailing list > Users@openvz.org > https://lists.openvz.org/mailman/listinfo/users _______________________________________________ Users mailing list Users@openvz.org https://lists.openvz.org/mailman/listinfo/users