Getting DRS VMotion info from you database

Ever wanted to know how often DRS is vmotioning your VMs?

You can extract this info from the VC database by the following query:

With the following SQL command, you can extract the info:

SELECT vpx_event.event_type, vpx_event.vm_name, vpx_event.create_time from vpx_event where event_type like ‘%migrate%’

(Credits go to: Dave.Mishchenko http://communities.vmware.com/message/969563)

Now if you filter on the event_type “vim.event.DrsVmMigratedEvent” you see all DRS Vmotions. Eventtype vim.event.VmMigratedEvent is for manual vmotions.

Looking at the VI environment my customer is running, I got the following results (after playing a bit in Excel):

Over a period of 285 days, we had:

1962 DRS vmotions (6.8 per day)

181 Manual vmotions (0.63 per day)

And the VMs that got vmotioned most often:

vm01 (2vcpu 4Gb) 49x
vm02 (4vcpu 4Gb) 44x
vm03 (2vcpu 1,5Gb) 41x
vm04 (4vcpu 4Gb) 39x
vm05 (4vcpu 4Gb) 35x

This out of a total of 400+ VMs.

8 thoughts on “Getting DRS VMotion info from you database

  1. Can you filter out the DRS VMotions that were done due to hosts been put in maintenance mode? Presumably over a period of 285 days they patched at least once, and DRS does really help out here in saving us having to VMotion the ~20 to 50 VMs manually, but these VMotions are arguable human initiated and not DRS initiated.

  2. Hi
    That is a good comment, I would have to look into that. I have no ESX host home to put into maintenance mode. So I can’t test it.

    I do however see that there are three entries:
    vim.event.EnteredMaintenanceModeEvent
    vim.event.EnteringMaintenanceModeEvent
    vim.event.ExitMaintenanceModeEvent

    These would be key events to figure this out.

    Gabrie

  3. Does this also work for you on ESX 3.5 update1 ?

    I cant find any event_type like ‘%migrate%’…

  4. @Danni: If you are quering a database of a cluster that has never done any vmotions, chances are that you can’t find this event type.

    Gabrie

  5. Hi again,

    I must have had some syntax error in my previous query – It works now :-) Thanks.

    What I am trying to accomplish is an overview of vmotions and WHY the vmotion happened. If you have any great ideas :-)

Comments are closed.