Feb 17 2017

Nutanix AHV VM Reporting


Updated: 2017-10-03 – New script available Nutanix AHV VM Reporting Via REST API

Updated 2017-08-18 – Latest version is 1.5
Improved disk usage and protection domain reporting capabilities performance increased.

Updated 2017-08-18 – Latest version is 1.4
Script performance increased. Now taking 5 min instead of 11 min In my lab environment.

Updated 2017-08-17 – Latest version is 1.3
Corrected duplicate host name reporting and memory reporting when max_hotplug_memory_mb is not defined.

Updated 2017-03-23 – Latest version is 1.2
Problem with spaces in VM names corrected.

Updated 2017-02-22 – Latest version is 1.1
Added VM Disk Usage Information but there are some problems with reporting correct utilisation when VMs are included in Protection Domains. Working on that.


While I was visiting a customer the other week we started to talk about VM reporting for Nutanix AHV and what we can do. There are several options to get the information required e.g. via REST API, ncli, acli, PowerShell and so on. Since this customer runs no Windows based VMs or physical workstations we decided to create a simple report using a bash script that includes the following:

  • VM Name
  • Total Number of vCPUs
  • Number of CPUs
  • Number of Cores per vCPU
  • Memory GB
  • Disk Usage GB
  • Disk Allocated GB
  • Acropolis Snapshots
  • Protection Domain Snapshots
  • Network Placement
  • IP Address
  • AHV Host placement

Right now, version 1.5, creates a comma separated file and runs on any of the Nutanix Cluster Controller Virtual Machines (CVMs). However, the idea is to both add additional information to the report and also change it to use the Nutanix REST API to get the information so it is easy to run the script remote.

This is what the report looks like after opening it up in excel and:

  • Text to column based on the Delimited option only Comma as field separator.
  • Some colour magic:)

Run the script below from any CVM and in the below example I have created an output catalog on the CVM called /home/nutanix/report so make sure to change the variable file if you want to store the report in another location.



  1. Sergey

    $(($numvcpu * $cpucores)) said bash -> syntax error: operand expected (error token is “* “)

    should be replaced with $((numvcpu * cpucores)) ?

  2. magander3

    no $(($numvcpu * $cpucores)) should be ok. Not getting any error when running the script.
    Can you send me script output and also run the following 5 commands (replace vmname with a name of a VM in your environment) and send me the output?

    numvcpu=/usr/local/nutanix/bin/acli vm.get vmname | grep -i num_vcpus |awk -F":" '{print $2}'| awk -F" " '{print $1}'
    cpucores=/usr/local/nutanix/bin/acli vm.get vmname | grep -i num_cores_per_vcpu |awk -F":" '{print $2}' | awk -F" " '{print $1}'
    echo $numvcpu
    echo $cpucores
    echo $(($numvcpu * $cpucores))


  3. magander3

    so the problem was spaces in the VM names. Script is updated to manage this now.


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 class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">