2,187
edits
m (Added additional note to "Available Metrics") |
m (→Available Metrics: Revised) |
||
Line 159: | Line 159: | ||
=== Available Metrics === | === Available Metrics === | ||
Metrics are available for | Metrics are available for all objects you'd expect (and probably more), not limited to the following... | ||
* Virtual Machines | * Virtual Machines | ||
* Virtual machines Hosts (ESX's) | * Virtual machines Hosts (ESX's) | ||
* Resource Pools | * Resource Pools | ||
* Datastores | * Datastores | ||
For a full list of what objects have what performance counters, and what those counters mean see http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.PerformanceManager.html. | |||
The easiest way to ascertain what metric is available for what object is to use Get-StatType... | The easiest way to ascertain what metric is available for what object is to use Get-StatType... | ||
Line 172: | Line 174: | ||
mem.granted.average | mem.granted.average | ||
mem.active.average | mem.active.average | ||
... | |||
[vSphere PowerCLI] E:\> Get-VMHost "esx-server*" | Get-StatType | [vSphere PowerCLI] E:\> Get-VMHost "esx-server*" | Get-StatType | ||
Line 196: | Line 185: | ||
mem.zero.average | mem.zero.average | ||
mem.unreserved.average | mem.unreserved.average | ||
...</source> | |||
'''In order to determine which sampling periods are available''', you need to use the '''<code> Get-StatInterval </code>''' command. Remember that there is also the '''Realtime''' interval, at which all metrics are available. The results depend on whether you're connected to a Virtual Centre (and how its configured) or an ESX (and whether that's being managed by a VC)... | |||
<source lang="powershell"> | <source lang="powershell"> | ||
[vSphere PowerCLI] E:\> Get-StatInterval | [vSphere PowerCLI] E:\> Get-StatInterval | ||
Line 225: | Line 197: | ||
Past Month 7200 2592000 VMware.VimAutomation.... | Past Month 7200 2592000 VMware.VimAutomation.... | ||
Past Year 86400 31536000 VMware.VimAutomation.... | Past Year 86400 31536000 VMware.VimAutomation.... | ||
</source> | |||
However, just because a metric is available, doesn't make it available in the interval you'd like. '''In order to find out whether a statistic is available in the interval you'd like''', you need to use the '''<code> Get-StatType -Interval <secs/name> </code>'''... | |||
<source lang="powershell"> | |||
[vSphere PowerCLI] E:\> Get-VMHost "esx-server*" | Get-Stat -MaxSamples 5 -IntervalSecs 300 | [vSphere PowerCLI] E:\> Get-VMHost "esx-server*" | Get-Stat -MaxSamples 5 -IntervalSecs 300 | ||
Line 265: | Line 241: | ||
A couple of final points to note | A couple of final points to note | ||
* To retrieve data for the Realtime interval, use the <code> -Realtime </code> option, not <code> -IntervalSecs 20 </code> | * To retrieve data for the Realtime interval, use the <code> -Realtime </code> option, not <code> -IntervalSecs 20 </code> | ||
** All metrics | ** All Realtime metrics are averages (as they're an average over the sampling period) | ||
* Virtual Centre generally drops metrics during roll-ups etc (subject to configuration), therefore for the fullest range of metrics, check with the ESX direct (though only 20sec and 300sec intervals are available). | * Virtual Centre generally drops metrics during roll-ups etc (subject to configuration), therefore for the fullest range of metrics, check with the ESX direct (though only 20sec and 300sec intervals are available). | ||
** I'd suggest always trying to go via the Virtual Centre, but the data you're after isn't available, check with the ESX direct. | ** I'd suggest always trying to go via the Virtual Centre, but the data you're after isn't available, check with the ESX direct. | ||
* Be careful when | * Be careful when retrieving metrics that might have multiple instances (eg CPU), this is relatively obvious in vSphere as it'll show an instance column, not so in VI3. You can filter so as to see, for example, only the aggregate instance | ||
** <source lang="powershell">get-vmhost "esx-server*" | get-stat -Stat cpu.usage.average -MaxSamples 1 -Realtime | Where{$_.Instance -eq ""}</source> | ** <source lang="powershell">get-vmhost "esx-server*" | get-stat -Stat cpu.usage.average -MaxSamples 1 -Realtime | Where{$_.Instance -eq ""}</source> | ||