A really useful tool that I leverage from time to time is VCSIM (vCenter Simulator) which can be found within the VCSA (vCenter Server Appliance). VCSIM allows you to easily "simulate" a custom vSphere Inventory that can be used for a variety of use cases including custom reports using the vSphere API/CLIs. There are additional capabilities that VCSIM provides and one that I have not explored much is the simulation of vSphere Performance Metrics. Having received a couple of inquires regarding VCSIM and performance metrics, I figure this would be a good opportunity to explore this feature in a bit more detail.
Disclaimer: This is not officially supported by VMware, use at your own risk.
Before getting starting, you should familiarize yourself with VCSIM by reading these two articles here and here.
By default when running VCSIM, there are no Performance Metrics. If you wish to include it, you will need to ensure the following two lines are added to your VCSIM configuration file:
<perfCounterInfo>vcsim/model/PerfCounterInfo.xml</perfCounterInfo>
<metricMetadata>vcsim/model/metricMetadata.cfg</metricMetadata>
The first file contains the performance metric definitions that are supported and the second file will specify which metrics will be simulated. To demonstrate the performance metric capabilities of VCSIM, I will be using the following configuration files which you can just copy/paste:
vghetto-perf-vcsim.cfg - This will be our VCSIM configuration file
<simulator> <enabled>true</enabled> <initInventory>vcsim/model/vghetto-perf-inventory.cfg</initInventory> <hostConfigLocation>vcsim/model/hostConfig</hostConfigLocation> <perfCounterInfo>vcsim/model/PerfCounterInfo.xml</perfCounterInfo> <metricMetadata>vcsim/model/metricMetadata.cfg</metricMetadata> <datastore> <global>1</global> <cluster>2</cluster> <local>1</local> <prefix>vghetto</prefix> </datastore> </simulator>
vghetto-perf-inventory.cfg - This will be our VCSIM inventory configuration file
<config> <inventory> <dc>1</dc> <host-per-dc>0</host-per-dc> <vm-per-host>0</vm-per-host> <poweron-vm-per-host>0</poweron-vm-per-host> <cluster-per-dc>1</cluster-per-dc> <host-per-cluster>2</host-per-cluster> <rp-per-cluster>1</rp-per-cluster> <vm-per-rp>3</vm-per-rp> <poweron-vm-per-rp>3</poweron-vm-per-rp> <dv-portgroups>0</dv-portgroups> </inventory> <prefix>vGhetto-</prefix> <worker-threads>1</worker-threads> <synchronous>true</synchronous> </config>
To ensure everything is working, we can start VCIM by issuing the following command on the VCSA:
vmware-vcsim-start /etc/vmware-vpx/vcsim/model/vghetto-perf-vcsim.cfg
If everything is working, you should be able to login using the vSphere Web/C# Client to view the small inventory we just created. If you are able to see the inventory, then go ahead and stop VCSIM by issusing the following command:
vmware-vcim-stop false
Note: To ensure our inventory is not destroyed each time, you should pass in the 'false' flag else it will automatically be deleted each time. This is useful if you want to preserve your inventory on subsequent reboots.
For all Performance Metric configurations, you will only need to edit the metricMetadata.cfg file. VCSIM supports four different types of Stats model:
- Constant
- Linear
- Square
- Triangle
We will take a look at Stats model for 2-4 since the Constant is not all that interesting 🙂 For our examples, we will take a look at each Stats model for the datastore.datastoreIops.average metrics.
Linear Stats Model:
<Metric id="datastore.datastoreIops.average"> <Instance id="Default"/> <StatsModel> <Type>Triangle</Type> <Values>0,20,10,30,0</Values> <Periods>600,300,600,900</Periods> </StatsModel> </Instance> <Instance id="HostDatastore"/> </Metric>
Square Stats Model:
<Metric id="datastore.datastoreIops.average"> <Instance id="Default"/> <StatsModel> <Type>Square</Type> <Values>0,10,0,20,0</Values> <Periods>300,300,600,600,300</Periods> </StatsModel> </Instance> <Instance id="HostDatastore"/> </Metric>
Triangle Stats Model:
<Metric id="datastore.datastoreIops.average"> <Instance id="Default"/> <StatsModel> <Type>Triangle</Type> <Values>0,20,10,30,0</Values> <Periods>600,300,600,900</Periods> </StatsModel> </Instance> <Instance id="HostDatastore"/> </Metric>
I thought this was pretty neat that the VCSIM developers included a couple of Stats Models that could be leveraged right out of the box! As you can see, it is pretty easy to enable various performance metrics simply by identifying the metric(s) you are interested in and specifying the Stats Model and then starting up VCSIM. The other neat thing that I have been asked about before is can VCSIM simulate performance metrics for specific vSphere entities? I originally thought the answer was no until I started to play with the performance metric simulator a bit more and realize there is a List property that you can use to specify the specific objects in which you want data to be displayed.
Here is an example of of the same performance metric we have been looking at but only enabling it for two Datastores:
<Metric id="datastore.datastoreIops.average"> <Instance id="List"> <List>vghettoDS_vGhetto-DC0_C0_0,vghettoDS_vGhetto-DC0_C0_1</List> <StatsModel> <Type>Triangle</Type> <Values>0,20,10,30,0</Values> <Periods>600,300,600,900</Periods> </StatsModel> </Instance> <Instance id="HostDatastore"/> </Metric>
Note: One thing I noticed while playing with the performance metric simulator is that some times the object in the UI is blank when using the vSphere Web Client. If I use the vSphere C# Client, it is perfectly fine and that is also true if you are using the vSphere API to query for these metrics.
Hopefully this was a good overview of how the VCSIM performance metrics feature works. I know there are a couple of internal folks who have used VCSIM injunction with vCenter Operations and I am also curious to see what other neat uses cases exists for the performance metrics feature. Also, if you have created a really cool metricMetadata.cfg configuration file, feel free to share with the rest of the community!
virtualrol says
William thanks for this post, it's really good
Suresh Dhanaraj says
Thanks William. Good one. I am planing to use it for VMTurbo testing use case for capacity planing.
Mike says
Thanks for this post.
How to get a full list of available stats Metric id ?
Franz Lao says
Thanks for this post.
Is VCSIM capable of generating IP address for the VMs?
William Lam says
No, it is not. The list of capabilities are described in an earlier VCSIM post
Franz Lao says
Thank you William.
jahid says
where to download the software ?