VMware Cloud Community
zsoltesz
Enthusiast
Enthusiast
Jump to solution

custom grupping in get-stat command

Hi,

What is the best method for grupping the result of get-stat  by a custom  date value. For exampla, how can use a 2 hours grupping interval in the next code?

....| Group-Object -Property {$_.Timestamp.hour},{$_.Entity.Name} |...

Thanks

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

I would do something like this

Group-Object -Property {[int]($_.Timestamp.Hour/2)}

But note that if your metrics span over more than 1 day, this will place metrics from different days, but from the same 2-hour interval, in the same group.


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

I would do something like this

Group-Object -Property {[int]($_.Timestamp.Hour/2)}

But note that if your metrics span over more than 1 day, this will place metrics from different days, but from the same 2-hour interval, in the same group.


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

0 Kudos
zsoltesz
Enthusiast
Enthusiast
Jump to solution

Thank Luc for your help!

Simple and grate solution!

Zoli

0 Kudos