VMware Cloud Community
john23
Commander
Commander

Need active mem usage on ESX host level

Hi,

From VC performance chart, I can get the active mem usage for VM level, I am looking for active mem usage at ESX host level using power cli script.

I know, VC doesn't provide any parameter for this. If possible, from power shell please let me know.

-A

Thanks -A Read my blogs: www.openwriteup.com
0 Kudos
5 Replies
LucD
Leadership
Leadership

You can get those metrics by providing an ESXi host object on the Entity parameter of the Get-Stat cmdlet.

Like this for example

$esx = Get-VMHost -Name MyEsx

$stats = Get-Stat -Entity $esx -Stat "mem.usage.average" -Start (Get-Date).AddDays(-1)


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

0 Kudos
john23
Commander
Commander

Thanks for quick response...

VM active mem usage shows the actual utilization.

ESX host mem usage shows the consumed mem( means <=allocate vm mem +overhead mem).

I just want to use active mem usage of vm and calculate the actual active mem usage for host using vm's parameters.

-a

Thanks -A Read my blogs: www.openwriteup.com
0 Kudos
LucD
Leadership
Leadership

You mean like this

$vm = Get-VMHost -Name MyEsx | Get-VM
Get-Stat -Entity $vm -Stat "mem.active.average" -Start (Get-Date).AddMinutes(-5) -ErrorAction SilentlyContinue |
Group-Object -Property {$_.Entity.Name} | %{
 
$_.Group | Measure-Object -Property Value -Average | Select -ExpandProperty Average
}
| Measure-Object -Sum | Select -ExpandProperty Sum

First we take the average for each VM, and then we summarise these averages.


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

0 Kudos
john23
Commander
Commander

Thanks LuCd,

I have tried the script, its failing..I have done the required changes...

Thanks -A Read my blogs: www.openwriteup.com
0 Kudos
LucD
Leadership
Leadership

Failing in what sense ? Do you get an error message, are there no values returned... ?


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

0 Kudos