VMware Cloud Community
owjeff
Enthusiast
Enthusiast

Get-Stat on Powered Off VM

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?

0 Kudos
5 Replies
LucD
Leadership
Leadership

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

owjeff
Enthusiast
Enthusiast

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?

0 Kudos
owjeff
Enthusiast
Enthusiast

I set intervalSecs to 1800 and it started reporting data.

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
owjeff
Enthusiast
Enthusiast

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.

0 Kudos