Skip to content

Trachti/nutanix_uuid_discovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nutanix UUID Discovery Script

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.

Features

  • 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

Requirements

  • Python 3.8 or newer
  • Network access to Nutanix Prism Central
  • A valid Nutanix Prism Central API token

No external Python packages are required.

Configuration

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"

Usage

Print tables and Python configuration blocks:

python nutanix_uuid_discovery.py

Print only tables:

python nutanix_uuid_discovery.py --output table

Print only ready-to-copy Python configuration blocks:

python nutanix_uuid_discovery.py --output config

Print JSON output:

python nutanix_uuid_discovery.py --output json

Write JSON output to a file:

python nutanix_uuid_discovery.py --json-file nutanix-uuid-discovery.json

Example Output

Clusters
--------
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",
    },
}

Security Notes

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.

Disclaimer

This script is provided as an example. Test it in a safe environment before using it against production Nutanix infrastructure.

About

Discover Nutanix cluster and subnet UUIDs from Prism Central with Python

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages