Introduction
Daily cluster health checks are a best practice for Nutanix administrators. While Prism offers visual insights, Bash scripting combined with ncli allows you to create repeatable, automated health assessments. This guide walks through how to script these checks, log results, and optionally integrate notifications.
My Personal Repository on GitHub
Benefits of Automating Cluster Health Checks
- No need to log into Prism for daily visibility
- Logs can be centralized or stored for audits
- Can trigger alerts for failed health states
- Useful for MSPs managing multiple clusters
Diagram: Automated Health Check Flow

Step-by-Step Bash Script
#!/usr/bin/env bash
set -euo pipefail
# Location for health logs
logfile="/var/log/nutanix/cluster_health_$(date +'%F').log"
# Run the health check
echo "[$(date)] Running Nutanix cluster health check" >> "$logfile"
ncli cluster get-health >> "$logfile"
# Basic alert condition
if grep -qi 'FAIL' "$logfile"; then
echo "[$(date)] ⚠️ Health check FAILED" >> "$logfile"
# Optional: send email or webhook alert here
else
echo "[$(date)] ✅ Cluster is healthy" >> "$logfile"
fi
Advanced Enhancements
1. Email Alerts
Integrate with mailx, sendmail, or an SMTP relay:
mailx -s "Nutanix Health Alert" admin@example.com < "$logfile"
2. Push to Monitoring Tools
Forward results to:
- Splunk using HTTP Event Collector (HEC)
- Logstash/Elastic for trend analytics
- Slack via
curlwebhook for team visibility
Scheduling the Health Check
Add the script to cron:
0 7 * * * /usr/local/bin/nutanix_health.sh
Runs daily at 7:00 AM and appends results to /var/log/nutanix.
Summary
With minimal setup, Nutanix cluster health checks can be fully automated. Bash and ncli provide a reliable, extensible way to gain insight into infrastructure status before users notice problems. Integrating alerts and logs further strengthens the value of this workflow.
External Documentation Link:
Introduction Nutanix’s CLI tools provide the same administrative power as the Prism GUI, but in a faster and more scriptable format. With...