Monitor the size of your vDisks

In a recent thread on the VMTN PowerCLI Community someone asked if it is possible to get historical hard disk statistics. I referred the user to my Datastore usage statistics post, where I showed how to use the “disk” metrics to get that information.

But getting the individual vDisk statistics is a bit more tricky compared to getting the datastore statistics, as I showed in that post. The “disk” metrics hold the information, but the Instance that points to the MoRef value of a VM makes it a bit more tricky to retrieve.

Be forewarned, the “disk” metrics hold usage data for all the vDisks that a specific VM has on a specific datastore. You will not be able to get individual vDisk statistics, unless the vDisks are stored on different datastores !

On the positive side, the “disk” metrics will allow you to see how your vDisks increase in size over time. For your Thick vDisks that increase will be by expanding them, and for your Thin vDisks it will also show the natural growth.

Continue reading Monitor the size of your vDisks

vNIC transmit and receive rates

The VMTN PowerCLI Community is a constant source of inspiration for blog posts. User roswellevent raised, in the thread Any way to get virtual machine Nic card usage?, the question if it was possible to get the transmit and receive rate for each vNIC in virtual machines.

Since I’m interested in all things statistics in vSphere I decided to tackle the question. Finding the metrics to use for this kind of report is not too difficult. Under the PerformanceManager Network section we find the metrics net.received.average and net.transmitted.average. And, provided your Statistics Level is set to 3 for the timeframe you want to report on, the metrics capture statistics on the device level.

Great, exactly what we need! A quick check in the Performance tab in the vSphere Client showed an additional problem to solve. The instance didn’t mention Network Adapter 1 but a number.

Continue reading vNIC transmit and receive rates

Will Invoke-VMScript work ?

The Invoke-VMScript cmdlet can be a very useful cmdlet, but sometimes it will fail against one or more of your VMs. And it is not always immediately clear why the Invoke-VMScript cmdlet will not work against that specific VM.
The cmdlet help contains a number of prerequisites, but how do you verify if all the prerequisites are fulfilled?
I decided to create a function that would verify the prerequisites, and that would, if requested, which of the prerequisites was missing.

Continue reading Will Invoke-VMScript work ?

Storage Views – Datastores

In the vCenter Client, since vSphere 4, you can find a Storage Views tab on several of the VI containers. The data in these Storage Views is collected and provided by the vCenter Storage Monitoring plug-in.

Have a look at David Davis‘s post, called Using VMware vSphere Storage Views, for more information on what you can do with the Storage Views.

Some time ago I got a question from Andrew how the Multipathing Status presented in the Storage Views could be detected and reported upon by a PowerCLI script. What looked rather simple at first, turned out to be a bit more difficult than I anticipated.

Continue reading Storage Views – Datastores

Orphaned files and folders – Spring cleaning

In our PowerCLI book we presented a Delete-Harddisk function in Chapter 7.

One of our readers asked if that function could be used to remove orphaned VMDK files from one or more datastores. Now unfortunately that is not the case since the function we presented in chapter 7 uses the ReconfigVM_Task method to remove the harddisk.

In the PowerCLI Community there are some thread that provide scripts to report on orphaned VMDK files, but most of these are quite old.

So I decided to write a new script that would report on orphaned folders and VMDK files and that would have an option to remove these folders and files.

Continue reading Orphaned files and folders – Spring cleaning

Virtual Machine logging

I recently received an interesting question in my mailbox. Someone wanted to know if it was possible to enable/disable the logging for a Virtual Machine through PowerCLI. These Virtual Machine logs can be a handy resource when analysing problems.
This logging option is available through the vSphere client when you select Edit Settings and then Options-Advanced-General. In that form there is a checkbox that allows you to enable/disable the virtual machine logging.

Afaik, this feature is not yet available through a PowerCLI cmdlet. But it is easily accessible through the VirtualMachine object.

Continue reading Virtual Machine logging