Regular Expression Cheat Sheet

Below is a quick reference guide for regular expressions that I frequently use and find useful.

Online RegEx debugger and library –

Utilising vSphere Performance Monitoring Tools – Part One: ESXTOP

The main use case for using ESXTOP is to retrieve more granular information that that provided in the vSphere Web Client in order to troubleshoot performance issues, and therefore is a better choice that using performance graphs. ESXTOP has as number of modes which are useful in a number of situations:

  • Interactive   – workload is steady and allows for the administrator to examine all the necessary data.
  • Batch – Allows for data to be retrieved in a comma-delimited file to be examined later using a third party tool. This is particularly useful if you want to use another tool to not only examine the data but to also visualize the data.
  • Replay – Allows for the input of data collected using the vm-support command to display data as if this was being produced by the host system.  In combination with batch mode this is useful for workloads that require troubleshooting that provide a particular pattern over a short period of time by allowing data to be retrieved and then examined at a later date and also workloads that need to be monitored over a long period of time.

In this example I will collect data at two second intervals for a duration of two minutes by invoking the vm-support command and saving the output to the datastore named ‘Datastore-01’ in a folder named ‘support’.

1) Browse to the folder to create the output file

cd /vmfs/volumes/Datastore-01/tmp

2) Invoke the vm-support command to retrieve perrformance data (-p) for a period of two minutes (-d 120) at an interval of two seconds (-i) and to save the output file (-w) to the datastore location specified.

vm-support -p -d 120 -i 2 -w /vmmfs/volumes/Datastore-01/support.

3) Now we will browse to the output file and extract the file.

tar -xzf esx-esxi1host.domain.local-2015-01-17--18.06.tgz

4) Once the file has been extracted browse to the contents and execute the reconstruct script.


5) Now we can browse to the parent folder and replay the batch collection.

esxtop -R esx-esxi1host.domain.local-2015-01-17--18.06

ESXTOP allows for the use of custom profiles to save changes to the selections for resource types and fields and to to be able to save these changes to load in the future. In the below example, I will create a custom profile named ‘memswap’ and select to display memory swap statistics only.

1) Press ‘m’ to display memory statistics.

2) Press ‘f’ to display the available memory fields.

3) Select the following fields ‘B’ (GID = Group ID), ‘D’ (Name = Name) and ‘K’ (SWAP STATS = Swap Statistics(MB)) and enter to return to the statistics.

4) Press the ‘W’ key to save the settings into a custom file, in this case ‘memswap’.

5) Press ‘q’ to quit ESXTOP.

Now in order to verify that ESX starts with the custom profile we have created in Steps 1-5, run the following command to start with the custom profile. This step should verify that ESXTOP opens to the swap statistics and only these statistics are displayed.

esxtop -c memswap

It is possible to create multiple custom profiles for use with ESXTOP for monitoring different resource types. Also, you can modify the default ESXTOP profile, while allows for the data displayed by ESXTOP when it is opened to be controlled. In order to make changes to the default profile open ESXTOP without specifying a profile, make changes to the selections as required and then save the (‘W’) the custom profile without specifying a profile, this will write changes to the default profile which is stored at ‘/.esxtop50rc’.

The below is a list of ESXTOP metrics and thresholds for reference taken from Duncan Epping at















2014 in review

The stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 83,000 times in 2014. If it were an exhibit at the Louvre Museum, it would take about 4 days for that many people to see it.

Click here to see the complete report.

PowerCLI: Consolidating virtual machine disks

In order to retrieve a list of virtual machines which are reporting t the issue ‘Virtual machine disks consolidation is needed’ we can invoke the Get-VM cmdlet to determine if a virtual machine consolidation is required.

$VMs = Get-VM | Where-Object {$_.ExtensionData.RunTime.ConsolidationNeeded}

To consolidate snapshots for a collection of virtual machines we can now perform the following, where the virtual machine consolidation will complete before invoking the script block on the next object.

ForEach ($VM in $VMs)

    (Get-VM $VM).ExtensionData.ConsolidateVMDisks()