VMware {code} Community
vrinda
Contributor
Contributor

VI SDK Command to get CPU and Memory utilization of an ESX server

Hi,

Can you guys tell me the command from VI SDK to get the CPU and Memory utilization of an ESX server.

Attached is the screenshot for clarity.

Thanks.................

0 Kudos
4 Replies
stumpr
Virtuoso
Virtuoso

The HostListSummaryQuickStats object will probably provide what you are looking for. This is available from HostSystem.

Are you looking for a code sample?

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
rmcateer
Contributor
Contributor

Always looking for c# code samples...

0 Kudos
admin
Immortal
Immortal

Please find a perl script, fetching the cpu usage and memory usage.

0 Kudos
halr9000
Commander
Commander

Here's an answer in PowerShell:

Process {
	$HostView = Get-View $_.Id
	$Process = "" | Select-Object VMHostName, OverallStatus, OverallCpuUsage, OverallMemoryUsage
	$Process.VMHostName = $_.Name
	$Process.OverallStatus = $HostView.Summary.OverallStatus
	$Process.OverallCpuUsage = $HostView.Summary.Quickstats.OverallCpuUsage
	$Process.OverallMemoryUsage = $HostView.Summary.Quickstats.OverallMemoryUsage
	Write-Output $Process
}

For more details and output examples, see my blog post about it here: http://halr9000.com/article/492

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos