7

For Xen Linux guests, %steal time is readily available via top and other utilities.

Is it possible to get this and related metrics from within a Linux guest when running a non-Xen hypervisor such as ESXi or Hyper-V?

For Windows guests, both VMware and Microsoft provide perfmon counters. Example: vmware perfmon

But these don't seem to be exposed via vanilla top in Centos 6.4.

4
  • See this Q&A from SF: serverfault.com/questions/392216/…. Read Ryan's answer for details on the hypervisors support.
    – slm
    Oct 1, 2013 at 13:37
  • It's a great answer and I contributed an update but my question above is intended to be much more narrow: Linux guest, standard tools, two specific hypervisors. Oct 1, 2013 at 13:45
  • Check the command mpstat -P ALL as well. It too reports %steal.
    – slm
    Oct 1, 2013 at 13:59
  • I do not see the above VM Processor object on Win2012 hosted on EC2... is there such? (would love to measure cpu steal on EC2 and rackspace cloud Win servers) Jan 9, 2014 at 3:48

3 Answers 3

7

The only way to get these (and more) performance counters inside a VMware guest, is by using the VMGuestLib SDK as shipped with the vmware-tools.

I wrote a python wrapper for this library, called python-vmguestlib and a tool vmguest-stats to get access to these counters. And there are now three Dstat plugins to correlate these performance counters with other system resources. It is as simple as:

dstat -c –vm-cpu -m –vm-mem –vm-mem-adv

You can find the python wrapper, the vmguest-stats tool and Dstat at:

Feedback and improvements welcomed !

4
  • –vm-cpu no longer appears to be available with this tool
    – Andy Smith
    Mar 14, 2017 at 14:25
  • Andy, did you install the plugins, because the options are tight to the availability of the plugins. github.com/dagwieers/dstat/blob/master/plugins/dstat_vm_cpu.py
    – Dag Wieers
    Mar 16, 2017 at 12:07
  • Aah, I did not, I installed using my OS (CentOS 7) package manager. Thanks
    – Andy Smith
    Mar 17, 2017 at 13:26
  • Im trying to use this library from open vm tools in my ubuntu installed on vmware workstation 12 but im getting an error not enabled when calling UpdateInfo, did you encounter this problem?
    – tomer.z
    Mar 12, 2018 at 19:17
0

the vSphere cluster at work is overloaded, but the usual Zabbix measurement tool wasn't indicating CPU steal time. So many thanks to Dag, I took his test program and wrote a script just to print steal percentage as follows

#!/usr/bin/python

import sys, os, time
sys.path.append(os.path.join('/root/dagwieers/vmguestlib/'))

from vmguestlib import VMGuestLib

gl = VMGuestLib()

gl.UpdateInfo()
stolen_ms_1 = gl.GetCpuStolenMs()

time.sleep(1)

gl.UpdateInfo()
stolen_ms_2 = gl.GetCpuStolenMs()

# print percentage of stolen time
print '%d' % ((stolen_ms_2 - stolen_ms_1) / 10)

gl.CloseHandle()

it confirmed what I thought, I'm often losing 75% of my CPU time!

2
  • Hmm, sometimes my script prints 140; so I must have misunderstood the units in Dag's program? My VM has four cores, so perhaps the CPU steal could go to 400%, if it's measuring one core at 100%?
    – Paul M
    Jul 11, 2016 at 17:33
  • For the calculation of percentages, look at: github.com/dagwieers/vmguestlib/blob/master/vmguest-stats
    – Dag Wieers
    Mar 16, 2017 at 12:12
0

As I understand, you are counting total stolen milliseconds.

At this point you know few about the steal impact.

If you calculate the stolen milliseconds divided by the amount of VMs you'll get the stolen milliseconds per VM.

Then, dividing the stolen milliseconds by the actual milliseconds on which the stolen value applies (the interval of counting the stolen milliseconds), you'll get the % of time that a VM has been stolen (in average).

So the calculation would be % stolen per VM = stolenms / #VMsOn / intervalms

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.