Scheduled Nutanix Capacity Reporting via CLI

Introduction

Capacity reporting is a crucial part of maintaining a healthy infrastructure. Instead of checking cluster metrics manually, automate them using Nutanix’s ncli. This script provides daily insights into memory, CPU, and storage availability, perfect for operational dashboards and email alerts.


My Personal Repository on GitHub

Nutanix Repository on GitHub


Diagram: Scheduled Capacity Report Flow


Sample Output Fields

  • Cluster UUID & Name
  • Total/Used/Free CPU
  • Total/Used/Free Memory
  • Storage Container Usage
  • Reserved Capacity Warnings

Bash Script: nutanix_capacity_report.sh

#!/usr/bin/env bash
set -euo pipefail

log="/var/log/nutanix_capacity_$(date +%F).log"
echo "[$(date)] Nutanix Cluster Capacity Summary" > "$log"

# Run capacity summary
ncli cluster get-summary >> "$log"

# Optional: parse and extract values for alerting
total_mem=$(ncli cluster get-summary | grep "Total Memory" | awk '{print $3 $4}')
used_mem=$(ncli cluster get-summary | grep "Used Memory" | awk '{print $3 $4}')

echo "Memory Usage: $used_mem of $total_mem" >> "$log"

Schedule with Cron

30 5 * * * /usr/local/bin/nutanix_capacity_report.sh

This runs daily at 5:30 AM and logs output for analysis or email.


Optional Add-On: Email Report

mailx -s "Daily Nutanix Capacity Report" ops@example.com < "$log"

Summary

By automating Nutanix capacity reports using ncli, you stay ahead of resource constraints. These reports offer early insights into bottlenecks, VM sprawl, and storage planning needs.

External Documentation:

Leave a Reply

Discover more from Digital Thought Disruption

Subscribe now to keep reading and get access to the full archive.

Continue reading