VMware Cloud Community
Guv
Enthusiast
Enthusiast

Get-Stat for a VM for last 3 days and interval 20 mins

I want to use the get-stat command to give the memory counter values for a specific VM for last night. I know you can do this in get-stat where you run a command with some parameters and then it list values for the last day or something. I cant seem to remember. I think its possible using the parameters such as realtime and maxsamples but cant remember. I need to get memory counters for the last 3 days with a time interval of 20 mins or 30 mins for a specific VM.

Can someone assist with this command line.

Thanks

0 Kudos
1 Reply
LucD
Leadership
Leadership

With Realtime you get only data for the last hour and with Historical Interval 1 only for the last day.

Have a look at PowerCLI & vSphere statistics – Part 1 – The basics.

If you want to get the statistical data over intervals that do not correspond with the default intervals, have a look at PowerCLI & vSphere statistics – Part 2 – Come together.

The cmdlet you could use looks like this

Get-Stat -Start (Get-Date).adddays(-3) -Stat mem.usage.average -Entity (Get-VM -Name <vm-name>)

This will return data for 30-minute intervals since your start date falls in Historical Interval 2.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos