Apps and tools built by our engineers that are intended to be played with and explored.

vCenter Cluster Performance Tool

vCenter Cluster Performance Tool


vCenter Cluster Performance Tool is a Powershell script that uses vSphere PowerCLI to obtain performance data for a cluster by aggregating information from individual hosts.

You have the following options to specify in the script.

  • An “interval” of 20s or 300s. The default is 20s, and corresponds to real time statistics. 300s corresponds to the 5 min interval statistics.
  • A stats query flag to obtain the list of counter IDs available on the vCenter Server. You can then pass the desired counter ID from that list to obtain Performance metrics for the cluster.


  • Gathers all data of the specified interval type that is available on each host in the specified cluster
  • Easy and a quick way of obtaining performance data for a vCenter cluster
  • Data is saved in a CSV file, which can then easily be fed into any charting software
  • A chart, in PNG format, is also generated for visualization


System Requirements


  • VMware vCenter Server 5.0 and above
  • PowerShell supporting Windows system (Windows XP and later)
  • VMware vSphere PowerCLI that is compatible with the vCenter Server
  • Microsoft Chart Controls for Microsoft .NET Framework 3.5


1. Installation

You need to install VMware PowerCLI and Microsoft Chart Controls. The PowerShell script does not need additional installation.

2. Before Running

Once installed, you will need to modify the scripts to specify locations of files as follows.

File: getClusterStats.ps1

Change $psCommand and $getHostStatsPrg to point to the location of powershell.exe and getHostStats.ps1 respectively.

Change $interval, if needed. This specifies the kind of Performance Statistics Samples to retrieve (in seconds) – either 20 (real-time, default), or 300 (5min samples).

File: getHostStats.ps1

Change $storeHostStats, $storeClsStats and $chartName to point to the locations of the individual host stats output file, aggregated cluster stats output file, and the performance chart file respectively.

3. CounterId

You can list all available counterIds on your vCenter Server by passing -1 for the counterId argument to getClusterStats.ps1.

From that list you can pass the desired counterId to the same argument to retrieve Performance Statistics for the given cluster. Note that not all of those counterIds may be available for a cluster object. Please refer to the VMware vSphere Web Services SDK Documentation for details on this topic.



Change Log


Adarsh Jagadeeshwaran


Ravi Soundararajan

Add Feedback

9 thoughts on “vCenter Cluster Performance Tool

  1. Anthony Hook

    So I’m running this as: .\getClusterStats.ps1 stop view-vc cluster 33, and I’m getting an error.

    I was able to run it successfully with parameter 1, however its seems to be broken with other counters (33, mem.active.average, for instance):

    Connected to view-vc
    host obj: HostSystem-host-12
    Counter mem.active.average[absolute,kiloBytes] for esx-v2.domainhere.local
    host obj: HostSystem-host-365
    Counter mem.active.average[absolute,kiloBytes] for esx-v1.domainhere.local
    Exception calling “DataBindXY” with “2” argument(s): “Enumeration already finis
    At C:\users\admin\Desktop\ClusterPerfFling-v2\getHostStats.ps1:228 char:40
    + $Chart.Series[“Data”].Points.DataBindXY <<<< ($timeStampArray, $clusterStatsA
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    Saving Chart to C:\Users\admin\Desktop\ClusterPerfFling-v2\Chart.png

    1. Adarsh

      The usage comments are in the file. I’ll copy paste them here (getClusterStats.ps1):
      # This script retrieves Performance metrics from a given vCenter cluster
      # To use this script you need to pass in the following parameters:
      # 0, the halt on error flag setting, if this is set to stop the script
      # will stop on errors reported back by the powershell api
      # 1, name of the vCenter Server
      # 2, name of the vCenter cluster
      # 3, counterId: The stat counterId to be passed in to the PerfQuerySpec; -1 to list all available counterIds

      Here’s an example:
      C:\> powershell .\getClusterStats.ps1 stop 2

      Here, I pass the “stop” parameter to tell powershell to stop if it encounters an error.
      The last parameter (2) is the counterId that represents “cpu.usage.average [rate,percent])”.
      The result I get is a chart that contains the cpu.usage.average of all hosts in the specified cluster from my vcenter server.

      Please read the “Instructions” tab of this fling to understand the rest of the options that you can use with this script.
      Hope that helps!

  2. Ankit

    Hi Guys,

    Could you please make this application to generate metrics for all available clusters together belong to same vCenter Server or may be multiple vCenter Servers if they are in linked mode.

    Ankit Sharma

    1. Ankit

      I am also trying to run this scrpt by following command but no luck.

      .\getClusterStats.ps1 0 vCenterName ClusterName -1

      If possible, could you please post a short video tuts on how to use this script. It would be much appreciated!

      1. Adarsh

        Hi Ankit,
        I’m sorry this was not explained in the notes.
        The first argument is a string value that is meant to specify the program what to do when it runs into some problem.
        Possible values are:
        “stop”, “continue” and “silentlycontinue”.
        Any other value will result in an error.
        Could you please try specifying the first argument as one of the above values, instead of “0”?

        Please let me know if you have any more issues.

        1. Ankit


          Thanks for quick turnaround. As per your suggestion, I made that change in getClusterStats.ps1, and it worked well with no error. But, the next issue I am facing is, it does not generating any output files ( csv or chart) at the location. I am assuming the second script getHostStats.ps1 will be invoked by getClusterStats.ps1 so need to call it separately. Let me know if I am missing anything here again.

          1. Adarsh

            Have you installed Microsoft Chart Controls for Microsoft .NET Framework 3.5 on your system?
            If yes, did you check the location of the chart (which is/can be specified from the program)?
            In file getHostStats.ps1, look for this parameter:
            ##Path to chart
            $chartName = “c:\powershell\Chart”

    2. Adarsh

      Also thanks for your ideas on improvements to the script. We’ll work on the improvements and keep you posted.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>