Me Again !
Thanks for your help so far, you guys are amazing.
If I am in VC and I click a Resource Pool I am able to see the CPU Usage and Memory usage of all VM's in that resource pool
IE
Production Resource Pool:
CPU Usage: 919 Mhz
Mem Usage: 4770 MB
Do you know how i might do this for a given resource pool name ?
Thanks
Perhaps. If you go into edit on the statistics levels it shows what is included for each level but not in detail.
I'm afraid you'll have to go the trial-and-error path
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I haven't done much stats stuff yet but play around with this:
get-resourcepool foo | get-stat
Hal Rottenberg
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Hi,
Below script will provide the required output.
$server = get-viserver -server ) -Stat cpu.usagemhz.average,cpu.usagemhz.maximum -Realtime
You can add the any number of required statistics counter with -stat separated by commas as I did for two counters.
-RealTime parameter provide the output at the interval of 20 second and for historical data you can remove this parameter.
For other flexibility like 5 days back data or restrict the number of output sample please refer the thread http://communities.vmware.com/message/962460
Thanks
Niket
Thanks, that gets the CPU usage of the resource group but I cant get the mem usage, if i change it for mem.usage.average it comes back as a percentage rather than the amount being used in that resource group.
Is it just me or does that not make sense, giving one type of figure for one counter and another for the same one of a different type ?
Anyway, any ideas how to get the memory please ?
Thanks
Try with mem.active.average, that will give you the "Amount of memory that is actively used".
For an overview of all performance counters and their meaning and availability see Appendix A in the Programming Guide VMware Infrastructure SDK 2.5
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have tried a fair few of these but I dont think the item has stats for these counters.
Did you use realtime stats ?
Get-Stat -Entity (Get-ResourcePool -Name <resource-pool-name>) -Stat mem.active.average -Realtime
returns statistics in my environment.
If not, did you check in the VI Client via menu <Administration><VirtualCenter Management Server Configuration><Statistics> if you keep statistics for the interval you requested ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yeah tried it and am not getting any results please see below:
PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-Stat -Entity
(Get-ResourcePool -Name "Production") -Stat mem.active.average -Realtime
PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-Stat -Entity
(Get-ResourcePool -Name "Production") -Realtime
MetricId Timestamp Value Unit
-
-
-
-
cpu.usagemhz.average 6/20/2008 9:50:00 AM 7947 MHz
cpu.usagemhz.average 6/20/2008 9:45:00 AM 7810 MHz
cpu.usagemhz.average 6/20/2008 9:40:00 AM 7607 MHz
cpu.usagemhz.average 6/20/2008 9:35:00 AM 7769 MHz
cpu.usagemhz.average 6/20/2008 9:30:00 AM 7650 MHz
cpu.usagemhz.average 6/20/2008 9:25:00 AM 7766 MHz
cpu.usagemhz.average 6/20/2008 9:20:00 AM 7433 MHz
cpu.usagemhz.average 6/20/2008 9:15:00 AM 7832 MHz
cpu.usagemhz.average 6/20/2008 9:10:00 AM 7960 MHz
cpu.usagemhz.average 6/20/2008 9:05:00 AM 8336 MHz
mem.usage.average 6/20/2008 9:50:00 AM 225.8 %
mem.usage.average 6/20/2008 9:45:00 AM 216.65 %
mem.usage.average 6/20/2008 9:40:00 AM 218.06 %
mem.usage.average 6/20/2008 9:35:00 AM 216.45 %
mem.usage.average 6/20/2008 9:30:00 AM 215.55 %
mem.usage.average 6/20/2008 9:25:00 AM 218.68 %
mem.usage.average 6/20/2008 9:20:00 AM 219.87 %
mem.usage.average 6/20/2008 9:15:00 AM 229.59 %
mem.usage.average 6/20/2008 9:10:00 AM 222.4 %
mem.usage.average 6/20/2008 9:05:00 AM 215.85 %
Same script which you ran.
PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-Stat -Entity (Get-ResourcePool -Name "Production") -Stat mem.active.average -Realtime
giving the right output:
MetricId Timestamp Value Unit
-
-
-
-
mem.active.average 6/20/2008 9:24:20 PM 29300 KB
mem.active.average 6/20/2008 9:24:00 PM 36624 KB
mem.active.average 6/20/2008 9:23:40 PM 36624 KB
mem.active.average 6/20/2008 9:23:20 PM 36624 KB
mem.active.average 6/20/2008 9:23:00 PM 29300 KB
mem.active.average 6/20/2008 9:22:40 PM 21976 KB
mem.active.average 6/20/2008 9:22:20 PM 21976 KB
mem.active.average 6/20/2008 9:22:00 PM 36624 KB
mem.active.average 6/20/2008 9:21:40 PM 36624 KB
mem.active.average 6/20/2008 9:21:20 PM 36624 KB
Try to run the script in new session of VI toolkit.
Thanks
Niket
That is strange, I have tried it in a new session through the toolkit and also through PowerGUI, I have even re-booted my pc !
Also tried it against a second Virtual Center server I have, do you think i should try and re-install the toolkit ?
Thanks fro all your help.
Alan
Did you try to see those stats via the VI Client ?
I don't think a reinstall will help.
If there was something wrong with the VI Toolkit you shouldn't see any stats.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yeah checked the VI stat settings and they are still default, anyway arent we doing it realtime. Dont understand why they are missing for resource pools in particular ?
If i do it for a VM it works fine, just resource groups...
Get-Stat -Entity (Get-vm -name "AMACHINE") -Stat mem.active.average -Realtime
I just experienced something similar a minute ago.
Can you try this
Get-Stat -Entity (Get-ResourcePool -Name <poolname>) -Stat mem.active.average -Realtime | Out-Default
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Still no output
Is it a bug in the toolkit ?
Don't think it's a bug in the Toolkit, otherwise we would all see it.
Does the Get-ResourcePool on it's own return something ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yeah that works fine and I can get the following two stats from it but nothing else....
Get-Stat -Entity (Get-ResourcePool -Name "Production") -Stat cpu.usagemhz.average -MaxSamples 1 -Realtime
Get-Stat -Entity (Get-ResourcePool -Name "Production") -Stat mem.usage.average -MaxSamples 1 -Realtime
Anyone else have any ideas ? Still not working :_|
You have to look at the Entity column in Appendix A in the SDK Programming Guide.
It shows clearly that there are not that many statistics available for resource groups.
For cpu stats for example it shows that for resource groups there is only usagemhz.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you use realtime stats ?
<pre> Get-Stat -Entity (Get-ResourcePool -Name <resource-pool-name>) -Stat mem.active.average -Realtime </pre>
returns statistics in my environment.
Just wondered how you get results for the above as this is what I want but do not get results, you said you do though.