Looking at historic CPU utilization

Looking at historic CPU utilization

Rate This
  • Comments 2

I came across this neat little aspect of the Virtual Server COM interface - which would be very handy if you wanted to make your own 'CPU history' graph.  It is the 'CPUUtilizationHistory' object which contains the last 60 CPU utilization measurements for a given virtual machine.

Here is a very simple script that will print out the 60 measurements for a virtual machine (specified via a command line parameter):

Set objVS = CreateObject("VirtualServer.Application")
set objVM = objVS.FindVirtualMachine(WScript.Arguments(0))
Set colAccountants = objVM.Accountant
       
i = 1
For Each intCPUUtilization in colAccountants.CPUUtilizationHistory
    Wscript.Echo i & ": " & intCPUUtilization
    i = i + 1
Next

Cheers,
Ben

Leave a Comment
  • Please add 2 and 8 and type the answer here:
  • Post
  • I am going to guess that the 60 measurement is the last 60 seconds?

    The help page on the graph says
    "A graphical representation of the CPU usage by this virtual machine over the previous minute."
    is this correct?

    Thanks,
    Adam
  • Yup.

    Cheers,
    Ben
Page 1 of 1 (2 items)