Hi All,
Am trying get all Events using get-VIEvents on Esxi, But it is showing only the Events related to host, Any idea how should I get "Show all Entries in powerCli ?"
If you don't specify an Entity value, you should be seeing all events.
This example returns all events for the last 7 days.
Get-VIEvent -Start (Get-Date).AddDays(-7) -MaxSamples ([int]::MaxValue)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD,
I tried that, But it gets me only the host events, How do I get all the events ?
The line above should give you all events, there must be something else going on.
What does this return?
Get-VIEvent -Start (Get-Date).AddDays(-7) -MaxSamples ([int]::MaxValue) |
Group-Object -Property {$_.GetType().Name}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Count Name Group
----- ---- -----
3 AlarmClearedEvent {VMware.Vim.AlarmClearedEvent, VMware.Vim.AlarmClearedEvent, VMware.Vim.AlarmClearedEvent}
28 AlarmStatusChangedEvent {VMware.Vim.AlarmStatusChangedEvent, VMware.Vim.AlarmStatusChangedEvent, VMware.Vim.AlarmStatusChangedEvent, VMware.Vim.AlarmStatusChangedEvent...}
3435 UserLogoutSessionEvent {VMware.Vim.UserLogoutSessionEvent, VMware.Vim.UserLogoutSessionEvent, VMware.Vim.UserLogoutSessionEvent, VMware.Vim.UserLogoutSessionEvent...}
174 EventEx {VMware.Vim.EventEx, VMware.Vim.EventEx, VMware.Vim.EventEx, VMware.Vim.EventEx...}
3434 UserLoginSessionEvent {VMware.Vim.UserLoginSessionEvent, VMware.Vim.UserLoginSessionEvent, VMware.Vim.UserLoginSessionEvent, VMware.Vim.UserLoginSessionEvent...}
35 TaskEvent {VMware.Vim.TaskEvent, VMware.Vim.TaskEvent, VMware.Vim.TaskEvent, VMware.Vim.TaskEvent...}
5 HostConnectedEvent {VMware.Vim.HostConnectedEvent, VMware.Vim.HostConnectedEvent, VMware.Vim.HostConnectedEvent, VMware.Vim.HostConnectedEvent...}
1 AlarmScriptCompleteEvent {VMware.Vim.AlarmScriptCompleteEvent}
4 AlarmEmailCompletedEvent {VMware.Vim.AlarmEmailCompletedEvent, VMware.Vim.AlarmEmailCompletedEvent, VMware.Vim.AlarmEmailCompletedEvent, VMware.Vim.AlarmEmailCompletedEvent}
8 AlarmActionTriggeredEvent {VMware.Vim.AlarmActionTriggeredEvent, VMware.Vim.AlarmActionTriggeredEvent, VMware.Vim.AlarmActionTriggeredEvent, VMware.Vim.AlarmActionTriggeredEvent...}
3 HostDisconnectedEvent {VMware.Vim.HostDisconnectedEvent, VMware.Vim.HostDisconnectedEvent, VMware.Vim.HostDisconnectedEvent}
2 AlarmAcknowledgedEvent {VMware.Vim.AlarmAcknowledgedEvent, VMware.Vim.AlarmAcknowledgedEvent}
2 AlarmScriptFailedEvent {VMware.Vim.AlarmScriptFailedEvent, VMware.Vim.AlarmScriptFailedEvent}
1 LocalTSMEnabledEvent {VMware.Vim.LocalTSMEnabledEvent}
1 EnteredMaintenanceMode... {VMware.Vim.EnteredMaintenanceModeEvent}
1 HostDasDisabledEvent {VMware.Vim.HostDasDisabledEvent}
1 EnteringMaintenanceMod... {VMware.Vim.EnteringMaintenanceModeEvent}
1 AlarmSnmpCompletedEvent {VMware.Vim.AlarmSnmpCompletedEvent}
1 HostConnectionLostEvent {VMware.Vim.HostConnectionLostEvent}
It looks as if you only might have permission to view the ESXi node(s).
You can only see events for which you have permission.
Can you for example see events on the root of the vCenter?
You are connected to a vCenter I assume, not an ESXi node?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have complete admin access on vCenter and I have connected to vCenter and used Get-Vmhost and passed that input to Get-vievents
You used Get-VMHost ?
That was not in the sample code I provided. There should be no Get-VMHost.
Can you show how exactly you are calling Get-VIEvent?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I get this issue as well and would like to know the solution if any.
Whether I choose a cluster or a host there always seems to be a difference between what I see in the console and what I see in powershell.
For example if I use "Get-VIEvent -Entity 'hostname' -MaxSamples 100 | Out-GridView" I notice the following;
In VC 'Show all entries' I get all the virtual machine associated alarms but in powershell I don't.
I think there is a clue to the mystery in what I have written, so the question is can I display all the events for a host and the VMs residing on it?
Similar for a cluster, can display all the events on a cluster as well as all the hosts and VMs that reside in it?
The reason for this is that the Get-VIEvent cmdlet hasn't implemented the "recurse" option.
In the underlying spec for retrieving events there is an option in the EventFilterSpecByEntity object, that allows one to specify if recursion should take place or not.
In my Get-VIEventPlus function I have implemented the Recurse option.
See Get the vMotion/svMotion history
Update: I submitted this idea on the PowerCLI Ideas site under Add a "recurse" option for the Entity parameter on the Get-VIEvent cmdlet.
You can upvote the idea if you would also like to see this implemented.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference