Automation

 View Only
  • 1.  cpu utilization of vms using powercli

    Posted Mar 25, 2021 01:41 AM

    HI Luc ,

    can yu suggest on the following requirement?

    need to create report where cpu utilization of vms  is less than 8 percent for last one month .

    do i need to enable stat level 3 for this  on vcenter ??

     



  • 2.  RE: cpu utilization of vms using powercli

    Posted Mar 25, 2021 04:00 AM

    also

    below is what gives avarage value  but i need percentage is there any direct property for percentage also similar to 

    cpu.usagemhz.average

     

     

     

    Get-VM | Where {$_.PowerState -eq "PoweredOn"} | Select Name,
    @{N="CPU Usage (Average), Mhz" ; E={[Math]::Round((($_ | Get-Stat -Stat cpu.usagemhz.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}}
    Export-Csv -Path c:AverageUsage.csv



  • 3.  RE: cpu utilization of vms using powercli

    Posted Mar 25, 2021 08:20 AM

    If you use the cpu.usage.average metric, you will have a percentage



  • 4.  RE: cpu utilization of vms using powercli

    Posted Mar 25, 2021 08:50 AM

    so inoder to get actual requirement of vms where cpu avg percentage is less than 8 percent for last 30 days 

    i need to put one more pipe  of |?{$_ -le "8"}} in below .can yu please check in lab if this gives correct result.

    E={[Math]::Round((($_ | Get-Stat -Stat cpu.usagemhz.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}}



  • 5.  RE: cpu utilization of vms using powercli

    Posted Mar 25, 2021 08:57 AM

    You are still using cpu.usagemhz.average



  • 6.  RE: cpu utilization of vms using powercli

    Posted Mar 25, 2021 09:03 AM

    am i not supposed to get rario of   cpu.usagemhz.average and esxi cpu core MHZ to find cpu percentage??



  • 7.  RE: cpu utilization of vms using powercli
    Best Answer

    Posted Mar 25, 2021 09:10 AM

    You could do that, but why, the cpu.usage.average metric returns the percentage directly.

    cpu.jpg