Custom VM Stats Report in CSV

December 20, 2021

by Laura Jordana

Intended Audience Level: Intermediate

Code Sample Type: Complete Script

Nutanix Technologies: Prism Element

Minimum Product Version: 5.10.3.2

Script/Code Language: Python

REST API Sample? Yes

REST API Version: v1

This script generates a CSV report based on the following VM statistics in the V1 API accessed through Prism Element.

  • VM Name
  • Cluster Name
  • Provisioned vCPUs
  • Memory Capacity
  • Disk Capacity
  • CPU Usage (%) (Max)
  • CPU Usage (%) (Average)
  • Memory Consumed (GiB) (Max)
  • Memory Consumed (GiB) (Average)
  • Memory Usage (%) (Max)
  • Memory Usage (%) (Average)
  • Guest File System Utilization (%) (Max)
  • Guest File System Utilization (%) (Average)
  • Network – Data Receive Rate (KBps) (Max)
  • Network – Data Receive Rate (KBps) (Average)
  • Network – Data Transmit Rate (KBps) (Max)
  • Network – Data Transmit Rate (KBps) (Average)

It has the following features:

  • Includes both the max and average for each metric
  • Displays the metric name in a human readable format (e.g. controller_user_bytes becomes Guest File System Utilization (%))
  • Converts metric values into specific units (i.e. storage/memory in GiB, network traffic in KBps)
  • Ability to pass in a custom duration (last x days), default is 30 days

It has been tested successfully on both older and newer versions of AOS:

  • 5.10.3.2
  • 5.20.1.1
  • 6.0.2

Full details and usage are in the README file of the repo.

Code Sample Details

This section may be empty if additional code sample details are not available.

This script generates a CSV report based on certain VM statistics in the V1 API accessed through Prism Element.