VMware Cloud Community
durag
Contributor
Contributor

Get-VMotion does not return any results

Hi,

I am trying to get some DRS Vmotion history and I am using the below Powershell cmdlet:

https://www.powershellgallery.com/packages/Get-VMotion/1.2.0

This works perfectly fine in a lab enviorment where I am connecting to vcenter with the one admin account we have. Commands run and I can see the vmotion history.

However, running it in prod is not working. Commands run, dont error out but dont return any results. Running a longer command will error out after 5 minutes to say it has reached its allocated time. I am using my named admin account which I normally use to manage vcenter as is the norm, rather than using a default administrator account in lab that everyone uses.

Would a specific user account be needed see these results? I wouldn't have thought so but I am running out of ideas. I can manage vcenter as normal through PowerCLI and my named account, it is just the Get-VMotion cmdlet results that aren't returning anything.

Thanks in advance

Labels (3)
0 Kudos
18 Replies
LucD
Leadership
Leadership

I suggest you open an Issue on the project site of that function.


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

0 Kudos
durag
Contributor
Contributor

OK, thanks LucD.

I was curious if anyone here has had any experience with this previously but I can for sure reach out.

Tags (1)
0 Kudos
LucD
Leadership
Leadership

You could try the function in my Get the vMotion/svMotion history post.


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

0 Kudos
durag
Contributor
Contributor

Thanks, I will check that out

0 Kudos
durag
Contributor
Contributor

Hi LucD,

Funnily enough, the same issue happens with your function. It runs perfectly fine in our lab environment but when I run it in prod it doesnt return any results. It doesnt error out, but doesnt return anything either. Only difference I can really see if that in the lab I am using the one shared DA account in the lab verses my own DA account in production.

0 Kudos
LucD
Leadership
Leadership

Are the permissions/roles for both accounts the same?


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

0 Kudos
durag
Contributor
Contributor

Yes, both are the same. Other PowerCLI commands and scripts work as normal on the same VM with my DA account so kind of scratching my head with this one.

0 Kudos
LucD
Leadership
Leadership

Did you check that a basic Get-VIEvent works in that environment?


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

0 Kudos
durag
Contributor
Contributor

Sorry for delay, was off sick. Yes, a Get-VIEvent does work in that environment, I was able to test it just there.

0 Kudos
LucD
Leadership
Leadership

Ok, let's check if the events the function is looking for are present.
Run

Get-VIEvent -Start (Get-Date).AddDays(-7) -MaxSamples ([int]::MaxValue) |
Group-Object -Property {$_.GetTYpe().Name}

Then check if DrsVmMigratedEvent and VmMigratedEvent events are present


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

0 Kudos
durag
Contributor
Contributor

Running in that environment now. Interestingly enough, I had to change the WebOperationTimeoutSeconds to not timeout for it to run past the 5 minutes, whereas in the lab environment it is set to the default of 300 seconds but it was allowed to run for far longer as it took almost 15 minutes to complete. I will post the results from prod once it completes

0 Kudos
LucD
Leadership
Leadership

Yes, the Get-VIEvent cmdlet takes a lot of time.
That was one of the reasons I wrote and use the Get-VIEventPlus function.

You could lower the interval, with the Start parameter.
Just make sure there was at least one vMotion done in the interval you use


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

0 Kudos
durag
Contributor
Contributor

Yes, I reduced it down to 1 as we have quite a large environment with a high number of vmotions every hour.

I will let it run and come back when it completes.

Thanks for your help so far.

0 Kudos
durag
Contributor
Contributor

After a week this still had not completed so I cancelled it and started it again on Friday with a 0.1 as an interval period and it finished this morning.

I can see both DrsVmMigratedEvent and VmEmigratingEvent in the output. I dont see a VmMigratedEvent.

0 Kudos
LucD
Leadership
Leadership

That looks as if the vMotions are done through DRS.
My function looks at the DrsVMMigratedEvent, so there should be results


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

0 Kudos
durag
Contributor
Contributor

Funnily enough, we deployed a new vcenter server and now I seem to be getting results to my queries so perhaps a vcenter issue all along.

Just one last question, what time zone is the CreatedTime property in? Is there a way to change this or is this bound by VMWare?

0 Kudos
LucD
Leadership
Leadership

That is in UTC.
You can convert with the ToLocalTime method.

$Event.CreatedTime.ToLocalTime()


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

0 Kudos
durag
Contributor
Contributor

OK. Thanks for your help.

0 Kudos