Code sample: Collecting cluster-wide VM performance data with Python - What are my VMs doing Collecting cluster-wide VM performance data with Python

When discussing automation tasks with customers, one of the common questions is “How do I collect performance statistics for my VMs?” In today’s quick article we’ll introduce a brand new complete code sample by Laura Jordana, Principal Technical Marketing Engineer at Nutanix, that does exactly that.

The requirements for Laura’s script were relatively simple:

  • Gather performance statistics for all VMs running on a specified cluster
  • Be able to specify the sample period for those statistics
  • Ability to specify which metrics are collected
  • Dump the stats into a CSV file for use with common analysis apps such as Google Sheets, Microsoft Excel (etc)

Shown below is an example of the data after being imported into Excel:

Imported data example
Demo of Laura’s script being run against one of our internal clusters

As you can see, the script creates highly usable data along with in-depth logging that can be used to analyse the results at any time.

Download Code Sample

VM performance metrics are currently exposed via the legacy Prism Element v1 REST APIs. Laura’s complete script and its documentation is available here: Custom VM Stats Report in CSV.

Related Resources

For related information on gathering performance metrics, please see the articles below:

Big thanks to Laura for publishing this code sample.

Thanks for reading and have a great day! 🙂