vmware / pyvmomi-community-samples

A place for community contributed samples for the pyVmomi library.
Apache License 2.0
1.01k stars 922 forks source link

Getting Host Related Events like Host Add/Delete, PG add/delete #644

Open padkrish opened 4 years ago

padkrish commented 4 years ago

Hello, I am trying to get the events for the following:

=> DVS and DVS-PG (DPG) Events like Add, Delete. => Regular PG events like Add, delete => VLAN modified on a DVS port group or a regular port group => Any CDP/LLDP neighbour change like the vnic or connected switch information

The DVS events seem to work fine (Thanks to prziborowski) when i give the id of type 'DvsCreatedEvent', 'DVPortgroupCreatedEvent', 'DvsDestroyedEvent' or 'DVPortgroupDestroyedEvent'.

But, for a regular PG events like create, delete or modify like VLAN. I do not see any events. I tried giving 'HostEvent' as the id, that did not help. Can someone please suggest how can i get events for the following:

a) Regular PG events like Add, delete b) Any CDP/LLDP neighbour change like the vnic or connected switch information

Is there any top level event or specific event ID associated with the above?

Thanks, KP

padkrish commented 4 years ago

I even tried all the below ID's as a part of the filter spec.

I tried all the below ID's in the filterSpec that seems even remotely related.

ids = ['Event', 'GeneralEvent', 'GeneralHostInfoEvent', 'HostEvent', 'DvsHostJoinedEvent', 'DvsHostLeftEvent', 'DVPortgroupEvent', 'DVPortgroupReconfiguredEvent', 'DvsReconfiguredEvent', 'DVPortgroupCreatedEvent', 'DVPortgroupDestroyedEvent', 'VmRelocatedEvent', 'DrsVmMigratedEvent', 'VmMigratedEvent', 'DvsCreatedEvent', 'DvsPortCreatedEvent', 'DvsDestroyedEvent']

... filterSpec = vim.event.EventFilterSpec(eventTypeId=ids, time=byTime, entity=byEntity)

So, is there any provision to get real time events for hosts and host PG's?