PowerCLI

 View Only
  • 1.  Getting CPU performance data with PowerCLI

    Posted Oct 16, 2013 10:47 PM

    Can I use powerCLI to do the following:?

    -Get 2 VMs.

    -Get the following metric: "CPU Demand (MHz)" for the last week

    -Export the data to csv



  • 2.  RE: Getting CPU performance data with PowerCLI

    Posted Oct 19, 2013 12:41 PM

    You mean something like this

    $entities = Get-VM -Name "VM1","VM2"
    $stat = "cpu.demand.average"
    $start = (Get-Date).AddDays(-7)

    Get-Stat -Entity $entities -Stat $stat -Start $start |
    Sort-Object -Property Timestamp,VM |
    Select @{N="VM";E={$_.Entity.Name}},Timestamp,Value |
    Export-Csv C:\report.csv -NoTypeInformation -UseCulture


  • 3.  RE: Getting CPU performance data with PowerCLI

    Posted Oct 21, 2013 02:36 PM

    Thanks again.  I'm getting the message "cpu.demand.average" doesn't exist for entity "virtual machine name".

    I don't get this message on "cpu.usagemhz.average".  I would rather get demand than usage if possible.  Any ideas?



  • 4.  RE: Getting CPU performance data with PowerCLI

    Posted Oct 21, 2013 05:12 PM

    DO you get that message for all VMs, or only some ?

    Were the VMs that give the error running around the Start time ?

    Is there data in the vSphere client under the Performance tab for that VM ?

    For the complete period you asked for (7 days back) ?

    Or similar in the web client



  • 5.  RE: Getting CPU performance data with PowerCLI

    Posted Oct 21, 2013 06:12 PM

    cpu.demand.average shows up in vSphere Client only for real-time data, not for past day or past week.

    The error happens on all VMs.
    Do I need to change my logging levels?



  • 6.  RE: Getting CPU performance data with PowerCLI

    Posted Oct 21, 2013 06:42 PM

    Yes, I suspect your statistics levels are not high enough.

    This counter requires level 2.



  • 7.  RE: Getting CPU performance data with PowerCLI

    Posted Oct 21, 2013 08:33 PM

    CPU Usage actually has collection level 1 and appears on all time periods but demand has collection level 2.  However demand still only appears on real-time data not on past day, week, or year



  • 8.  RE: Getting CPU performance data with PowerCLI

    Posted Oct 21, 2013 08:40 PM

    And what are your Statistics levels in the vCenter ?



  • 9.  RE: Getting CPU performance data with PowerCLI

    Posted Oct 22, 2013 06:07 PM

    All statistics levels are at level 1.  Assuming you are wanting to do long-term performance monitoring and capacity planning, is there a best practice of what these should be set to?  VMware seems to say that setting it at higher than level 2 should only be done for short periods of time, in other words 3 and 4 are only for short-term purposes.

    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2003885

    However, in your example you have some intervals at level 4.   There is plenty of room in my vCenter database, but I don't want to cause a performance issue with vCenter Server.  Is there a good guideline for how to set statics levels to maximize PowerCLI statistics reporting capabilities, but yet prevent a performance problem on vCenter?  In general I hear it said that you need 2-3 months of statistical data for things like CPU and memory statistics to establish baselines.  How do you best ride the line of getting sufficient historical data with enough metrics as far back as you need, but yet not cause performance problems? It does seem like average maximums for CPU and Memory that go back 60 days are a must for things like baselining and current state analysis.



  • 10.  RE: Getting CPU performance data with PowerCLI
    Best Answer

    Posted Oct 22, 2013 06:24 PM

    It is indeed a trade-off between the statistical data you want to keep online and performance/storage capacity on your vCenter server.

    For me there is no universal rule-of-thumb, you'll have to find the ideal setup for your environment and your specific requirements.

    In my environment, the 4/4/2/2 config works. Minimal performance impact, and I can get the online reports I need.

    Remember you can change the time and frequency of the aggregation jobs that run on the database, you don't have to stick with the defaults.

    But be aware of the impact on available data in each historical interval.

    And there are alternatives, as I mentioned in my reply in another of your threads: Re: Getting Peak Utilization with get-stat