Hi!,
I'm a total newbie using powershell and powercli and I'm trying to get the "Average VMs Sampled" as in /var/log/vmksummary using powercli (not using the log, but querying the vcenter)
Any clue?
Thanks!
Try this
Get-VMHost | select Name, @{N="NrVM"; E={($_|Get-VM).Count}}
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thx, but...
I want to get the "Monthly average running vms per host" (I supposed "Average VMs Sampled" was that)
I've tried with Get-Stat, but I haven't found perf counter about vms running :S
Thanks!
Unfortunately there is no performance metric that gives those values.
If you look in the cron file you see that the vmkheartbeat script produces the values.
For the number of guests running it uses a straightforward "ps -auxw | grep -c mware-vmx".
What you could do is download, with PowerCLI, the vmksummary file and extract the number from there
Get-VMHost <esx-name> | Get-Log -Key vmksummary
With some RegEx it shouldn't be too hard to extract the number.
Let me know if you need help with that ?
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
$report = ( $esx | Get-Log -Key vmksummary ) for ( $i = 0 ; $i -lt $report.LastLineNum ; $i++ ) { if ( ([string]($report.Entries[$i])).toLower().Contains("average vms") ) { $avevms = ( $report.Entries[$i] -replace "^\s*Average VMs Sampled: ", "" ) } }
That do the trick
Thanks LucD!