Feb 17 2017

Nutanix AHV VM Reporting


Updated 2017-03-23
Problem with spaces in VM names corrected.

Updated 2017-02-22
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.2, 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 to some color and text to columns magic:)

This is the script and make sure to uncomment the one of three lines under “Get the VMs to include in the report” so VMs are included in the script:)



  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="">