You can use the PowerCLI cmdlets to automate tasks for viewing and managing statistics for vCenter Server inventory objects.
You can modify the properties of a statistics interval and view statistics for a selected cluster.
Prerequisites
Verify that you are connected to a vCenter Server system.
Procedure
- Increase the amount of time for which statistics of the previous day are stored.
Set-StatInterval -Interval "past day" -StorageTimeSecs 700000
- View the available memory metric types for the Cluster1 cluster.
$cluster = Get-Cluster Cluster1
$statTypes = Get-StatType -Entity $cluster -Interval "past day" -Name mem.*
- View the cluster statistics collected for the day.
Get-Stat -Entity $cluster -Start ([System.DateTime]::Now.AddDays(-1)) -Finish ([System.DateTime]::Now) -Stat $statTypes