When you just have one ESX host and maybe 20-30 virtual machines, searching, sorting, and filtering are sometimes of little use. However, with 20+ VMs per server and a growing number of servers, it is easy to see how searching, sorting, and filtering objects in your virtual infrastructure can become very important very fast. Consider this scenario, if you had just 20 VMware ESX hosts and 30 VMs on each, that is over 600 virtual machines. How do you quickly find the VM that you are looking for? How do you find VMs that have ISOs attached as CD drives? How do you find the VMs that need their VMware Tools updated? How do you find the VMs that are running Windows XP? And, how do you find the ESX hosts that, say, have more than 8GB of RAM? The answer to all of these questions can be found with searching, sorting, and filtering.
Thankfully, VMware has made some tremendous improvements in the functionality of searching, sorting, and filtering in the new VMware vSphere 4 suite that will make it much easier to answer questions like these.
How do I search in the VMware vSphere virtual infrastructure?
Now, with vSphere 4, in every screen of the vSphere 4 client, you will see a Search Box. This is like having a Google Search Toolbar with you, everywhere you go. What this means is that you can feel comfortable navigating the client because you know that you can quickly find whatever VM, host, network, datastore, or folder you need. You can see what it looks like in Figure 1, below.
Figure 1: Searching in VMware vSphere 4
As you can see, you can perform a basic search on any part of the virtual infrastructure inventory – virtual machines, hosts, folders, datastores, and networks. However, the default is to search the entire inventory (any of those objects) and that is the icon you see to the left of the search box in Figure 1.
Let us say that you enter a virtual machine name, like “vista”. Here is what the search results might look like, in Figure 2.
Figure 2: Search results for a virtual machine
Let us say that you were looking for VM “Vista-1”, at this point, you can just click on that VM name and you will be taken to that VM in the virtual infrastructure, like this:
Figure 3: Shows how you are taken directly to a VM after your search
In another example, let us say that you were looking for an ESX host that had the name “esx” in the hostname. By typing “esx” in the search box, you search for every object in the inventory with the word ESX in it. In Figure 4, you can see how we find 3 ESX hosts that have the word “esx” in their name. To quickly navigate to any of these, just click on the search results.
Figure 4: Search results for an ESX host
These examples show how you can very quickly navigate to any object in the virtual infrastructure, just by searching.
How do I perform an Advanced Search in the vSphere client?
An advanced search in the vSphere client will give you many more search options than the basic search. You can perform an advanced search by clicking on the Advanced Search option at the bottom of the basic search results or you can press Ctrl-Shift-F from any screen. Either of these will take you to the screen shown in Figure 5, below.
Figure 5: Advanced Search using Options
In Figure 5, I entered the word “vista” in the search box, then opted to do a search with some advanced options. As you can see, I can add properties, if that property should contain or not contain, and then the text that I am searching for, for each property.
These properties can get very advanced. For example, I could perform searches like this:
All VMs that are powered off
All VMs that have out of date tools
All VMs that have “x” in their notes
All VMs that are running Linux as the guest OS
All ESX hosts that are powered off or on
All datastores that have at least X free space or less than Y free space
I can even search for custom attributes.
Then, you can take the search results and sort then by clicking on the column headings. That brings us to sorting and filtering…
How can I Sort and Filter in the vSphere client?
Sorting and Filtering is easy in the vSphere client. Sorting and Filtering is done on “list output”. Let me show you an example.
Let’s say that I go and view a list of all VMs or all hosts in a virtual datacenter. I can click on the column headings to sort the output by whatever column I choose - either ascending or descending. I can also add new columns by right-clicking on the column headings and selecting the new column I want to add. For example, in Figure 6 you can see how I sorted the VMs by their power state.
Figure 6: Sorting VMs by Power State
In Figure 7, you can see how I added the Guest OS column. Once added, I can sort on that as well to group all the VMs by their Guest OS type.
Figure 7: Adding the Guest OS column to the Virtual Machines List
Again, if you only have 10 VMs perhaps sorting and filtering are not that important. However, if you have 600 VMs, sorting and filtering can save you a huge amount of time.
How do I Filter output in the vSphere client?
Finally, let us talk about filtering output. Below the search box on any screen that contains a list that can be sorted, you will also see a filtering box, like this:
Figure 8: Filtering box in the vSphere client
You can type any text here and press enter to limit the output (filter it) by that text. Also, what is very important is what you are filtering by. To the left of the box in Figure 8, it says “Name, State, Host, or Guest OS contains”. These are the only columns that your filter text is going to filter on. These can be turned on or off by clicking the drop-down menu on that filter box, as you see in Figure 9, below.
Figure 9: Enabling Filtering Parameters
In Figure 10, notice how I entered the text “XP” in the Filter box to filter the list of VMs to show only the VMs that have the letters “XP” in their name, state, host, or Guest OS. In my case, I was entering “XP” because I knew that one of the VMs was running “Windows XP” as the Guest OS.
Figure 10: Filtering output using Guest OS
In this article, we learned that the vSphere Client 4 has many new options for Searching, Sorting, and Filtering. I know that these are going to save VMware admins (like me) a ton of time!