VMware Cloud Community
td_sk
Contributor
Contributor

collect the performance of esx host cluster wise from Vc.

Hi Thanks in advance.

    Is anybody having  a script to get the details of ESXi host resource utilization. for N numbers of days.

    EG.1. host memory use ,host memory ballooning,host swapping etc.

          2. Cpu total utilization & average

                      

ClusterhostTotal memoryTotal Cpu average memory usedavg cpu UseAvg Mem ballooningAvg Shared memoryAvg Activity memory Avg Mem swapping

     I am looking for a script which is having a complete report of esxi host with respective of performance.

Thanks

siv

0 Kudos
2 Replies
LucD
Leadership
Leadership

Try something like this

$clusterName = "MyCluster"
$days = 1
$start = (Get-Date).AddDays(- $days)
$stat = "cpu.usage.average","mem.usage.average","mem.vmmemctl.average",
 
"mem.shared.average","mem.active.average","mem.swapused.average"

$cluster = Get-Cluster -Name $clusterName
$esx = Get-VMHost -Location $cluster
Get-Stat -Entity $esx -Start $start -Stat $stat |
Group-Object -Property {$_.Entity.Name} |
Select @{N="Cluster";E={$cluster.Name}},
   
@{N="VMHost";E={$_.Name}},
   
@{N="Total memory";E={$_.Group[0].Entity.MemoryTotalGB}},
   
@{N="Total CPU";E={$_.Group[0].Entity.NumCpu}},
   
@{N="Average memory used";E={$_.Group | Where {$_.MetricId -eq "mem.usage.average"} |
     
Measure-Object -Property Value -Average | Select -ExpandProperty Average}},
   
@{N="Average CPU used";E={$_.Group | Where {$_.MetricId -eq "cpu.usage.average" -and $_.Instance -eq ""} |
     
Measure-Object -Property Value -Average | Select -ExpandProperty Average}},
   
@{N="Average memory ballooning";E={$_.Group | Where {$_.MetricId -eq "mem.vmmemctl.average"} |
     
Measure-Object -Property Value -Average | Select -ExpandProperty Average}},
   
@{N="Average shared memory";E={$_.Group | Where {$_.MetricId -eq "mem.shared.average"} |
     
Measure-Object -Property Value -Average | Select -ExpandProperty Average}},
   
@{N="Average active used";E={$_.Group | Where {$_.MetricId -eq "mem.active.average"} |
     
Measure-Object -Property Value -Average | Select -ExpandProperty Average}},
   
@{N="Average memory swapped";E={$_.Group | Where {$_.MetricId -eq "mem.swapused.average"} |
     
Measure-Object -Property Value -Average | Select -ExpandProperty Average}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

td_sk
Contributor
Contributor

Hi ,

  Thanks for your answer.

    The scripts gives the output is it possible to report it in HTML format. More over how to get the total memory used ,total ballooning,total shared memory, total active memory.

   The script is attached can you please correct me.

0 Kudos