VMware Cloud Community
DylanBright
Contributor
Contributor
Jump to solution

Problem with Get-Stat in the latest release

Does Get-stat not work in the latest (12/26) release?

It seems like I used to be able to do something like this in the previous version...

Get-Stat -Entity $myVM -Start (get-date).AddDays(-30) -CPU -Finish (get-date)

To get the last 30 days of data, but now it seems that no matter what I do, it only gives me the last hour's worth of stats. It is almost as if it was getting stats from Virtual Center before, and now it only get's stats directly from the host.

Does anyone else have this problem? Or better yet, a solution.

After further experimentation it works better when I set the -MaxSamples option to a large number and the IntervalMins to a larger number e.g.

get-stat $vm -start (get-date).AddDays(-30) -CPU -stat -cpu.usage.average -IntervalMins 60

I thought it was supposed to default to the smallest interval possible for the data period selected.

0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

The MaxSamples defaults to 10 if not otherwise specified, which is getting in the way of what you're trying to do by specifying the dates. We'll have to look at that interaction. The workaround for now as you noted is to specify a large MaxSamples.

In your example, if you want to collect all the stats in that time range with 5-minute granularity (assuming your server is configured with a 5-minute interval - if not, the closest available one will be picked), something like this should work:

get-stat $vm -start (get-date).AddDays(-30) -CPU -stat -cpu.usage.average -IntervalMins 5 -MaxSamples 10000

If you don't specify the interval, it should default to 10 or whatever the closest available interval is.

Antonio (VMware developer)

View solution in original post

0 Kudos
1 Reply
admin
Immortal
Immortal
Jump to solution

The MaxSamples defaults to 10 if not otherwise specified, which is getting in the way of what you're trying to do by specifying the dates. We'll have to look at that interaction. The workaround for now as you noted is to specify a large MaxSamples.

In your example, if you want to collect all the stats in that time range with 5-minute granularity (assuming your server is configured with a 5-minute interval - if not, the closest available one will be picked), something like this should work:

get-stat $vm -start (get-date).AddDays(-30) -CPU -stat -cpu.usage.average -IntervalMins 5 -MaxSamples 10000

If you don't specify the interval, it should default to 10 or whatever the closest available interval is.

Antonio (VMware developer)

0 Kudos