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:
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.
For related information on gathering performance metrics, please see the Nutanix.dev articles below:
- Getting VM Performance Metrics via API
- Getting performance stats with the Nutanix Prism API v2.0
- Nutanix.dev code samples
- Nutanix REST API reference (updated December 2021)
Big thanks to Laura for publishing this code sample.
Thanks for reading and have a great day! 🙂