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

Screenshot showing 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:

Continue reading

Nutanix VM Snapshot Management with CLI and Bash

Explore another guide in this topic and build on what you have just read. Read the article

1 thought on “Scheduled Nutanix Capacity Reporting via CLI”

Leave a Comment