< Back

Get-Stat

Sun Jan 19, 2020 6:52 pm

NAME Get-Stat



SYNOPSIS

This cmdlet retrieves the statistical information available on a vCenter Server system.





SYNTAX

Get-Stat [-Entity] <VIObject[]> [-Common] [-Cpu] [-Disk] [-Finish <DateTime>] [-Instance <String[]>]

[-IntervalMins <Int32[]>] [-IntervalSecs <Int32[]>] [-MaxSamples <Int32>] [-Memory] [-Network] [-Realtime]

[-Server <VIServer[]>] [-Start <DateTime>] [-Stat <String[]>] [<CommonParameters>]





DESCRIPTION

This cmdlet retrieves the statistical information available on a vCenter Server system 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 Stat parameter is specified, 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.





PARAMETERS

-Common [<SwitchParameter>]

Indicates whether the command collects common CPU, disk, memory and network statistics.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Cpu [<SwitchParameter>]

Indicates whether the command collects common CPU statistics, such as the average CPU usage and average CPU

usagemhz counters as appropriate for each entity.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Disk [<SwitchParameter>]

Indicates 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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Entity <VIObject[]>

Specifies the objects (such as virtual machine, virtual machine host, resource pool, and so on) whose

statistics you want to retrieve.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? true



-Finish <DateTime>

Specifies the end of the time range for which you want to collect statistics. The valid format is dd/mm/yyyy.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Instance <String[]>

Specifies the Instance property of the statistics you want to retrieve.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IntervalMins <Int32[]>

Specifies 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IntervalSecs <Int32[]>

Specifies 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 *.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-MaxSamples <Int32>

Specifies the maximum number of samples for each statistic.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Memory [<SwitchParameter>]

Indicates 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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Network [<SwitchParameter>]

Indicates 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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Realtime [<SwitchParameter>]

Indicates whether the command collects real time statistics.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Server <VIServer[]>

Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this

parameter, the command runs on the default servers. For more information about default servers, see the

description of Connect-VIServer.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Start <DateTime>

Specifies the beginning of the time range for which you want to collect statistics. The valid format is

dd/mm/yyyy.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Stat <String[]>

Specifies 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".



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Zero or more LongSample or FloatSample objects







NOTES





Samples are not generated for a virtual machine while it is powered off.



-------------------------- Example 1 --------------------------



Get-Stat -Entity $VM -Start 5/5/2013 -Finish 7/10/2013 -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 $MyVMHost -Cpu -Instance 0



Retrieves the CPU statistics for the first processor of a multiprocessor host.



Note: This command can only work with a direct ESX connection.

-------------------------- Example 3 --------------------------



Get-VMHost -Name "MyVMHost" | Get-Stat -Network -IntervalSecs 20



Retrieves the network usage statistics for the specified host for the specified time interval.

-------------------------- Example 4 --------------------------



Get-VM -Name "MyVM" | Get-Stat -Stat "mem.usage.average" -Start $MyStartDateTime -Finish $MyFinishDateTime

-MaxSamples 10



Retrieves the average memory usage statistics for the specified virtual machine between the specified start and

finish date and time. The maximum number of retrieved samples is limited to 10.

-------------------------- Example 5 --------------------------



Get-VM -Name "MyVM" | Get-Stat -CPU -Memory -Realtime



Retrieves the real-time CPU and memory usage statistics for the specified virtual machine.

-------------------------- Example 6 --------------------------



Get-VMHost -Name "MyVMHost" | Get-Stat -Common



Retrieves the common statistics for the specified host.

-------------------------- Example 7 --------------------------



Get-Stat -Entity "MyVMHost" -Disk



Retrieves the disk usage statistics for the specified host.



RELATED LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... -Stat.html

Get-StatType

Get-StatInterval

New-StatInterval

Remove-StatInterval

Set-StatInterval