VMware Communities > Blogs > John Tuffin's Blog > 2008

Blog Posts

John Tuffin's Blog : July 2008

Previous Next
0

Get-stat

Posted by cpqarray VMware Jul 21, 2008

I've been playing around with the get-stat command. Thanks a bunch to Brian Denicola at http://www.bjd145.org/labels/vmware%20powershell.html for posting the example.

To grab memory stats from an ESX host type the command get-stat $esx -Memory -maxsamples 3 -realtime this will grab 3 memory samples from the server $esx.

For example

$vc = get-viserver myvcserver -username admin -password vmware
$esx = get-vmhost MyEsxServer
$get-stat $esx -Memory -maxsamples 3 -realtime
The -common switch gives averages for all major hardware subsystems cpu,memory, disk, and networking.

$get-stat $esx -common -maxsamples 1 -realtime
There is also a way to pull individual counters provided that you know the counter name

get-stat $esx -stat cpu.usagemhz.average
This returns the average cpu usage in MHZ over the interval of collection. The list of all counters can be found here:

http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/visdk25programmingguide.pdf

0 Comments Permalink