Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 232869

Re: PowerCLI One-Liner for CPU Usage

$
0
0

I suspect your confusion comes from the fact that the vSphere client shows the Average, Minimum and Maximum over the past month for the cpu.usage.average counter. Besides that there also exist counters, but not available in statistics level 1, that are called cpu.usage.maximum and cpu.usage.minimum.

 

To simulate what you see in the vSphere client you can do

 

 

$entity=Get-VM-NameMyVM
$start
= (Get-Date).AddMonths(-1)$counter="cpu.usage.average"
Get-Stat
-Entity$entity-Stat$counter-Start$start|
Group-Object
-Property {$_.Entity.Name} |%$stats=$_.Group|Measure-Object-PropertyValue-Average-Maximum-Minimum
 
New-ObjectPSObject-Property@{    VM=$_.Name
   
CPUAvg=$stats.Average
   
CPUMin=$stats.Minimum
    CPUMax=$stats.Maximum
  } }

Viewing all articles
Browse latest Browse all 232869

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>