A Python script for discovering Nutanix cluster UUIDs and subnet UUIDs from Prism Central.
The script connects to Nutanix Prism Central, lists clusters and subnets, and can print the results as tables, JSON, or ready-to-copy Python configuration blocks.
- Discovers Nutanix cluster UUIDs
- Discovers Nutanix subnet UUIDs
- Shows subnet VLAN IDs
- Shows subnet cluster references
- Prints readable tables
- Prints ready-to-copy Python configuration blocks
- Can export discovery results as JSON
- Uses only the Python standard library
- Python 3.8 or newer
- Network access to Nutanix Prism Central
- A valid Nutanix Prism Central API token
No external Python packages are required.
Before running the script, update these values in nutanix_uuid_discovery.py:
NTNX_PRISMCENTRAL_IP = "YOUR_IP:9440"
PC_TOKEN = "YOUR GENERATED TOKEN FROM nutanix_auth.py"Print tables and Python configuration blocks:
python nutanix_uuid_discovery.pyPrint only tables:
python nutanix_uuid_discovery.py --output tablePrint only ready-to-copy Python configuration blocks:
python nutanix_uuid_discovery.py --output configPrint JSON output:
python nutanix_uuid_discovery.py --output jsonWrite JSON output to a file:
python nutanix_uuid_discovery.py --json-file nutanix-uuid-discovery.jsonClusters
--------
Name UUID External IP
--------- ------------------------------------ -----------
cluster01 00000000-0000-0000-0000-000000000000 10.0.0.10
Subnets
-------
Name UUID VLAN Cluster
---------- ------------------------------------ ---- --------
vlan-80 00000000-0000-0000-0000-000000000000 80 cluster01
Example configuration block:
CLUSTER_UUIDS = {
"cluster01": "00000000-0000-0000-0000-000000000000",
}
SUBNET_UUIDS = {
"cluster01": {
"80": "00000000-0000-0000-0000-000000000000",
},
}Do not commit real API tokens, passwords, cluster UUIDs, subnet UUIDs, Prism Central addresses, or internal infrastructure details to a public GitHub repository.
The script currently disables SSL certificate verification by using:
ssl._create_unverified_context()This may be useful in lab environments, but it is not recommended for production. For production use, configure proper certificate validation.
This script is provided as an example. Test it in a safe environment before using it against production Nutanix infrastructure.