I realize a powered off VM will not generate statistics, but why can't any historical data be retrieved? I am able to view the data in the "Past Day" rollup from the vSphere client, but running this:
$VM | get-stat -stat $stat -start $start -finish $finish
Yields no results if the VM is currently powered off. We have a script that grabs disk IO data nightly and we'll be missing data if the VM is powered off when the script runs. Is there another cmdlet or option that will allow me to grab the historical data even if the VM is off?
It depends on which time interval you select with the Start and Finish parameters.
The Get-Stat cmdlet determines on these times from which Historical Interval the statistical data will come.
Try setting the Start further back in time.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I did try that. I set the start and finish to the previous day (and a few days previous) but it will not return any data. Would setting the intervalSecs switch force it to pull from a specific rollup?
I set intervalSecs to 1800 and it started reporting data.
That's another way of selecting Historical Interval 2.
If you would have put the Start back to more than 1 week, you would also have ended up in HI2.
See my PowerCLI & vSphere statistics – Part 1 – The basics post for more details.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That wouldn't have worked for my needs though. Consider that we needs statistics for yesterday, and the VM was powered off this morning. I need data from 12am yesterday to 12am today. The intervalSecs being set to 1800 accomplishes that.