Code sample: Collecting cluster-wide VM performance data with Python

Nutanix.dev - What are my VMs doing Collecting cluster-wide VM performance data with Python

Table of Contents

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 Nutanix.dev articles below:

Big thanks to Laura for publishing this code sample.

Thanks for reading and have a great day! 🙂

© 2024 Nutanix, Inc. All rights reserved. Nutanix, the Nutanix logo and all Nutanix product, feature and service names mentioned herein are registered trademarks or trademarks of Nutanix, Inc. in the United States and other countries. Other brand names mentioned herein are for identification purposes only and may be the trademarks of their respective holder(s). This post may contain links to external websites that are not part of Nutanix.com. Nutanix does not control these sites and disclaims all responsibility for the content or accuracy of any external site. Our decision to link to an external site should not be considered an endorsement of any content on such a site. Certain information contained in this post may relate to or be based on studies, publications, surveys and other data obtained from third-party sources and our own internal estimates and research. While we believe these third-party studies, publications, surveys and other data are reliable as of the date of this post, they have not independently verified, and we make no representation as to the adequacy, fairness, accuracy, or completeness of any information obtained from third-party sources.