WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Generating vCenter Server & Platform Services Controller deployment topology diagrams

Generating vCenter Server & Platform Services Controller deployment topology diagrams

05.02.2016 by William Lam // 16 Comments

A really useful capability that vCenter Server used to provide was a feature called vCenter Maps. I say "used to" because this feature was only available when using the vSphere C# Client and was not available in the vSphere Web Client. vCenter Maps provided a visual representation of your vCenter Server inventory along with the different relationships between your Virtual Machines, Hosts, Networks and Datastores. There were a variety of use cases for this feature but it was especially useful when it came to troubleshooting storage or networking connectivity. An administrator could quickly identify if they had an ESXi host that was not connected to the right datastore for example with just a few clicks.

vcenter_server_and_platform_services_controller_topology_diagram_3
Although much of this information can be obtained either manually or programmatically using the vSphere API, the consumption of this data can sometimes be more effective when it is visualized.

I was recently reminded of the vCenter Maps feature as I have seen an increase in discussions around the different vSphere 6.0 deployment topology options. This is an area where I think we could have leveraged visualizations to provide a better user experience to help our customers understand what they have deployed as it relates to install, upgrade and expansion of their vSphere environment. Today, this information is spread across a variety interfaces ranging from the vSphere Web Client (here and here) as well as across different CLIs (here and here) and there is nothing that aggregates all of this dispart information into an easy to consume manner. Collecting this information can also be challenging as you scale up the number of environments you are managing or dealing with complex deployments that can also span multiple sites.

Would it not be cool if you could easily extract and visualize your vSphere 6.0 deployment topology? 🙂

Well, this was a little side project I recently took up. I have created a small python script called extract_vsphere_deployment_topology.py that can run on either a Windows Platform Services Controller (PSC) or a vCenter Server Appliance (VCSA) PSC and from that system extract the current vSphere deployment topology which includes details about the individual vCenter Servers, SSO Sites as well as the PSC replication agreements. The result of the script is outputted in the DOT format, a popular graph description language which can then be used to generate a diagram like the example shown below.vcenter_server_and_platform_services_controller_topology_diagram_0Requirements:

  • vSphere 6.0 environment
  • Access to either a Windows or VCSA PSC as a System Administrator
  • SSO Administrator credentials

Step 1 - Download the extract_vsphere_deployment_topology.py python script to either your Windows vCenter Server PSC or vCenter Server Appliance (VCSA) PSC.

Step 2 - To run on a vCenter Server Appliance (VCSA) PSC, you will need to first set the script to an executable by running the following command:

chmod +x extract_vsphere_deployment_topology.py

To run on a vCenter Server for Windows PSC, you will need to first update your environmental PATH variable to include the python interpreter. Follow the directions here if you have never done this before and add C:\Program Files\VMware\vCenter Server\python

Step 3 - The script requires that you provide an SSO Administrator username and password. You can specify everything in the command-line or you omit the password in which you would then be prompted to enter.

To run the script on a VCSA PSC, run the following command specifying your credentials:

./extract_vsphere_deployment_topology.py  -u *protected email* -p VMware1!

To run the script on Windows VC PSC, run the following command specifying your credentials:

python C:\Users\primp\Desktop\extract_vsphere_deployment_topology.py  -u *protected email* -p VMware1!

Here is an example output from one of my environments.

graph vghetto_vsphere_topology_extraction {
   graph [fontsize = 20,label = "\nSSO Domain: vsphere.local"];
   subgraph cluster_0 {
      style=filled;
      node [style=filled];
      "vcenter60-5.primp-industries.com" -- "psc-06.primp-industries.com"
      label = "Site: East-Coast";
    }
   subgraph cluster_1 {
      style=filled;
      node [style=filled];
      "vcenter60-4.primp-industries.com" -- "psc-05.primp-industries.com"
      "psc-05.primp-industries.com";
      label = "Site: West-Coast";
    }
   "psc-06.primp-industries.com" -- "psc-05.primp-industries.com"
   "vcenter60-4.primp-industries.com" [color="0.578 0.289 1.000"]
   "vcenter60-5.primp-industries.com" [color="0.578 0.289 1.000"]
   "psc-06.primp-industries.com" [color="0.355 0.563 1.000"];
   "psc-05.primp-industries.com" [color="0.355 0.563 1.000"];
}

Step 4 - Save the output from the script and then open a browser that has internet access to the following URL: http://www.webgraphviz.com Paste the output and then click on the "Generate Graph" which will generate a visual diagram of your vSphere deployment. Hopefully it is pretty straight forward to understand and I have also colorized the nodes to represent the different functionality such as Blue for a vCenter Server and Green for Platform Services Controller.

vcenter_server_and_platform_services_controller_topology_diagram_4
In addition, if you have deployed an Embedded vCenter Server which is replicating with an External PSC (which is considered a deprecated topology and will not be supported in the future), you will notice the node is colored Orange instead as seen in the example below.

vcenter_server_and_platform_services_controller_topology_diagram_1
This is pretty cool if you ask me! 😀 Just imagine the possibilities if you could use such an interface to also manage operations across a given vSphere deployment when it comes to install, upgrade and expansion of your existing environment. What do you think, would this be useful?

I have done a limited amount of testing across Windows and the VCSA using a couple of deployment scenarios. It is very possible that I could have missed something and if you are running into issues, it would be good to provide some details about your topology to help me further troubleshoot. I have not done any type of testing using load balancers, so it is very likely that the diagram may not be accurate for these scenarios but I would love to hear from folks if you have tried running the script in such environments.

More from my site

  • Which Platform Services Controller (PSC) is my vCenter Server pointing to?
  • vCenter Server 6.0 Tidbits Part 2: What is my SSO Domain Name & Site Name?
  • Auditing/Logging vCenter Server authentication & authorization activities
  • Maximum number of vCenter Servers per Single Sign-On (SSO) Domain
  • How to split vCenter Servers configured in an Enhanced Linked Mode (ELM)?

Categories // Automation, VCSA, vSphere 6.0 Tags // lstool.py, platform service controller, psc, vCenter Server, vcenter server appliance, vdcrepadmin, vmafd-cli, vSphere 6.0

Comments

  1. *protectedGanadmin says

    05/05/2016 at 2:23 pm

    Can you pls help me on the below error , I think we need to set the environment for the VCSA PSC also..

    Script to extract the deployment topology of your vSphere
    enviornment (vCenter Server & PSC) and output as DOT Graph
    : command not found
    ./map.py: line 10: import: command not found
    ./map.py: line 11: import: command not found
    ./map.py: line 12: import: command not found
    ./map.py: line 13: import: command not found
    ./map.py: line 14: import: command not found
    ./map.py: line 15: import: command not found
    ./map.py: line 16: import: command not found
    ./map.py: line 17: syntax error near unexpected token `os.environ['VMWARE_PYTHON_PATH'].split'
    ./map.py: line 17: `sys.path.extend(os.environ['VMWARE_PYTHON_PATH'].split(';'))'

    Reply
    • William Lam says

      05/05/2016 at 3:02 pm

      Is this a vSphere 6 env you're running this on?

      Reply
    • *protectedPYosifov says

      12/13/2016 at 7:05 am

      may be bcz python-script is running via linux shell? Try to add
      #!env python
      or full path to python interpreter

      Reply
  2. *protectedGanadmin says

    05/08/2016 at 11:07 am

    yes , it is VCSA with latest update..

    Reply
  3. *protectedGanadmin says

    05/08/2016 at 11:09 am

    i mean VCSA 6 env and i have tried two diff environment running on Vsphere 6 ,both got failed with the same error

    Reply
    • William Lam says

      05/13/2016 at 9:48 am

      What account are you using and could you describe how your environment is setup (e.g. VC and PSC)?

      Reply
      • *protectedGanadmin says

        05/17/2016 at 4:20 pm

        I am trying with *protected email* and I have one PSC external and VC appliance is connecting to the same.

        I think it is throwing error on the below line in the script..

        import atexit
        import argparse
        import getpass
        import os
        import socket
        import subprocess
        import sys

        Reply
  4. *protectedAlastair says

    05/09/2016 at 8:49 am

    Similar errors for me.

    Reply
  5. *protectedAnkit Mehrotra says

    07/13/2016 at 9:04 am

    Hi,

    Is there any acceptable network latency value between vCenter and external PSC loadbalancer VIP? Like for example - the network latency should be within 10 ms for vCenter services to successfully communicate with PSC or else they will timeout?

    Thanks,
    Ankit Mehrotra

    Reply
  6. *protectedBen Tanner says

    07/15/2016 at 11:21 pm

    This works brilliantly, but doesn't capture all the replication agreements between the PSCs in our environment - we have 5 PSCs in a fully meshed replication arrangement

    Reply
  7. *protectedRryan Hulce says

    08/05/2016 at 7:56 am

    When I run it I get the following (Most Current VCSA PSC Release):

    ./extract_vsphere_deployment_topology.py: line 5: syntax error near unexpected token `newline'
    ./extract_vsphere_deployment_topology.py: line 5: `'

    Reply
    • *protectedRryan Hulce says

      08/05/2016 at 8:35 am

      Hey, downloaded the file because it ended in .py but it was the URL. Don't be me...... It is working great. Thanks!

      Reply
      • *protectedDon says

        09/08/2016 at 9:02 am

        what is your workaround? I have same issue about new line at line 5.

        thanks

        Reply
  8. *protectedHappy says

    05/10/2017 at 1:52 pm

    Does this work in a 6.5 environment? Thanks.

    Reply
  9. *protectedcarl says

    01/03/2018 at 12:37 pm

    Sorry for the newbie question. (but i'm new) But I get the following when I run the PY script as stated above.

    Traceback (most recent call last):
    File "./extract_vsphere_deployment_topology.py", line 330, in
    main()
    File "./extract_vsphere_deployment_topology.py", line 310, in main
    psc_to_site,psc_servers,sso_sites = build_psc_to_site_relationship()
    File "./extract_vsphere_deployment_topology.py", line 115, in build_psc_to_site_relationship
    sso_site = delim[2][3:]
    IndexError: list index out of range

    this is on a 6.5 VCSA

    Reply
    • *protectedcarl says

      01/03/2018 at 12:40 pm

      Also for the new people.
      for me to get this to where I am

      1) I had to download with SCP from the VCSA to my SFTP server (uploding to my VCSA kept erroring.)
      2) I had initially copy pasted the code of the py script into a notepad session and saved as py. Doing this put carriage returns that the VCSA didn't like. So, I went to the 'raw' URL (https://raw.githubusercontent.com/lamw/vghetto-scripts/master/python/extract_vsphere_deployment_topology.py) to save the raw file to my SFTP for download.

      Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/2025
  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...