SyntaxGet-Stat [-Entity] <VIObject> [-Common] [-Memory] [-Cpu] [-Disk] [-Network] [-Stat <String>] [-Start <DateTime>] [-Finish <DateTime>] [-MaxSamples <Int32>] [-IntervalMins <Int32>] [-IntervalSecs <Int32>] [-Instance <String>] [-Realtime] [-Server <VIServer>] [<CommonParameters>]
Related CommandsOnline version
Detailed DescriptionRetrieves the statistical information available on a vSphere server for each provided entity. For example, if the CPU parameter is set to $true, collects the average CPU usage and the average CPU usagemhz counters as appropriate for each entity. If the Stats parameter is set to $true, collects all provided named stats counters. Counters are provided using a dotted notation of the form "counter group"."counter name"."rollup type". For example: "cpu.usage.min". The cmdlet uses the Start time, if provided, and the Finish time, if provided, along with the MaxSamples, if provided, to bound the data collection. If intervalSecs is provided, the closest matching available interval is used. For each statistics sample on the server, the cmdlet returns a Sample object. The Instance property of the Sample object shows the serial number of the device for which a statistics value is taken. If the Instance property is empty ("), this indicates that the statistics sample contains an average statistic value for all specified devices. If you are connected to a vCenter Server and Get-Stat is run for a host entity, the cmdlet returns only the statistics available on the vCenter Server.
|Name||Type||Description||Required?||Pipeline Input||Default Value|
|Entity||VIObject||Specify the objects (such as virtual machine, virtual machine host, resource pool, and so on) whose statistics you want to retrieve.||true||true (ByValue)|
|Common||SwitchParameter||Indicate whether the command collects common CPU, disk, memory and network statistics.||false||false|
|Cpu||SwitchParameter||Indicate whether the command collects common CPU statistics, such as the average CPU usage and average CPU usagemhz counters as appropriate for each entity.||false||false|
|Disk||SwitchParameter||Indicate whether the command collects common disk statistics, such as the average disk usage, average disk read and average disk write counters as appropriate for each entity.||false||false|
|Finish||DateTime||Specify the end of the time range for which you want to collect statistics. The valid format is dd/mm/yyyy.||false||false|
|Instance||String||Specify the Instance property of the statistics you want to retrieve.||false||false|
|IntervalMins||Int32||Specify one or more intervals in minutes of the statistics samples you want to retrieve. The closest available statistics interval is taken. To retrieve statistics samples for all available intervals, pass *.
If the IntervalMins parameter is not specified, the samples with the best sample rate are retrieved. A best sample rate is the highest sample rate, whose relevant period contains the relevant periods for all other sample rates. A relevant period is the period that starts no earlier than the oldest sample still retained, and is a subset of a query period specified by the user.
|IntervalSecs||Int32||Specify one or more intervals in seconds of the statistics samples you want to retrieve. The closest available statistics interval is taken. To retrieve statistics samples for all available intervals, pass *.||false||false|
|MaxSamples||Int32||Specify the maximum number of samples for each statistic.||false||false|
|Memory||SwitchParameter||Indicate whether the command collects common memory statistics, such as the mem usage, mem vmmemctl, mem active and mem granted counters as appropriate for each entity.||false||false|
|Network||SwitchParameter||Indicate whether the command collects common network statistics, such as the average network usage, average network transmitted and average network received counters as appropriate for each entity.||false||false|
|Realtime||SwitchParameter||Indicate whether the command collects real time statistics.||false||false|
|Server||VIServer||Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.||false||false|
|Start||DateTime||Specify the beginning of the time range for which you want to collect statistics. The valid format is dd/mm/yyyy.||false||false|
|Stat||String||Specify the identifiers of the statistics you want to retrieve. Counters are provided using a dotted notation of the form "counter group"."counter name"."rollup type". For example, "cpu.usage.min".||false||false|
NotesSamples are not generated for a virtual machine while it is powered off.
-------------- Example 1 --------------
Get-Stat -Entity VM -Start 5/5/2008 -Finish 7/10/2008 -Disk -IntervalSecs 300
Prints the disk statistics for the specified time interval for the first virtual machine, retrieved by the Get-VM cmdlet.
-------------- Example 2 --------------
Get-Stat -Entity Host -Cpu -Instance 0, "
Retrieves the cumulative statistics for a multiprocessor host and the CPU statistics for the first processor.