While great, managing events with the the VI Client can be a pain. No search functionality, old events fall off the list, etc, etc. So what is an admin to do?
A resourceful admin will have been playing with the VI Toolkit, and would have found the get-vievent cmdlet. Let’s take a look at how we can manage VI Events using this cmdlet in a few different scenarios:
First lets see what this cmdlet can do for us:
Cool! So here I point out a limitation of the cmdlet (or VI, or both) It will only return 1000 events, that’s it:
PS C:\> get-vievent -MaxSamples 1000 | Measure-Object
Count : 1000
PS C:\> get-vievent -MaxSamples 1350 | Measure-Object
Count : 1000
That doesn’t make sense does it? Not sure if it’s a bug or not, but with some of the other filters, you can really dig into your events without having to get more than the first thousand.
Lets take a look at how to get a list of the first 3 errors for my VI specifically:
get-vievent -MaxSamples 3 -types error
Cool? Lets take a look at what this looks like… if I wanted the first 3 events on a particular host:
PS C:\> get-vievent -MaxSamples 3 -Entity (get-vmhost|select -First 1)
Let’s combine that, and the start & finish switches, to get 3 error events from our ESX server, from last Tuesday to last Thursday:
PS C:\> get-vievent -MaxSamples 3 -Start 01/13/2009 -Finish 01/15/2009 -Entity (get-vmhost | select -First 1)
So, even with the 1000 event limitation, it’s still a pretty powerful cmdlet, no?
Questions? Leave them in the comments.
The thousand event thing is a bug. Sorry about that! I believe this is fixed in our upcoming 1.5 release but I don't want to say definitely.
No worries. One can manage around it, as in the post. Thanks for the heads
up tho!
The thousand event thing is a bug. Sorry about that! I believe this is fixed in our upcoming 1.5 release but I don't want to say definitely.
No worries. One can manage around it, as in the post. Thanks for the heads
up tho!