[Users] how to get the current HN CPU utilization by particular CT

knawnd at gmail.com knawnd at gmail.com
Tue May 17 03:02:50 EDT 2011


Tim Small wrote on 16/05/11 17:59:
> On 14/05/11 09:27, knawnd at gmail.com wrote:
>> As far as I understand in order to determine HN CPU load produced by
>> certain CT it is enough to extract 'user', 'system' and 'uptime'
>> values from /proc/vz/vestat twicely. Then the formula is
>> ct_cpu_usage=100%*[(user_time_2 + system_time_2) - (user_time_1 +
>> system_time_1)] / (uptime_2 - uptime_1)
> Can't really remember I'm afraid, but that sounds plausible, I think the
> figures collected from /proc are a total amount of CPU time used for
> each container, so to determine usage, you have to take two readings and
> divide by elapsed time.  The figure you get is the total across all CPU
> cores.
that's exactly what I need for now.
>> The second question is if there are any plans to implement HN CPU load
>> produced by particular CT in some of vz* tools (e.g. in vzcpucheck
>> providing some additional option and print one more column required
>> info about HN CPU utilization by each container)?
> Dunno.  Email the developers and see if they'd be willing to accept a
> patch in principle?
I guess (and hope) OpenVZ developers are also reading that list. So it 
would be interesting and useful to know their opinions on that.
> If not (or in any case) - I wonder if a "dstat" plugin might be a good
> solution?
>
> Actually I just looked at the dstat man page, and there seems to be a
> --vz-cpu option already....
Thanks for pointing that out! I guess dstat is also can be used. But the 
implementation of HN CPU utilization by each CT in vz-native tools is 
much more preferable way for me since there wouldn't be a need to 
install additional third-party software and it would be simpler to 
configure sudoers file.

Regards,
Nikolay.
>
> Tim.
>


More information about the Users mailing list