Unsolved
1 Rookie
•
76 Posts
2
959
Question from Class: How do I know if it's a "VxRail" Cluster? (Using PowerCLI to Discover VxRail)
I had a curious question from a VxRail class I taught. A customer in my class had many VxRail clusters among many non-VxRail clusters in their environment. The customer was an avid user of VMware PowerCLI and asked how they could discover if a vCenter was hosting any VxRail clusters. The goal was to generate a simple report detailing discovered VxRail clusters in their various vCenters. The customer didn’t know the IP address or FQDN of the VxRail Managers that a given vCenter may be potentially hosting. Additionally, the customer asked for the fastest way to find this information. I told the customer I would get back to them later in the day with a response. In the world of VxRail, there is a single VxRail Manger VM per cluster, assuming it is a VxRail cluster. The technique below has no reliance on any VxRail tools and is native to VMware PowerCLI. Let’s start with the basics.
We know upon installation, the VxRail Manager creates a variety of Custom Attributes. We can access these details in a myriad of ways. The easiest way is to log in into the vSphere Client, navigate to Hosts and Clusters > MyClusterName and select the Summary tab. A Custom Attributes section should be visible. Notice the VxRail-IP attribute. If we see attribute names starting with VxRail... we know it's a VxRail. Additionally, the VxRail-IP value is the information we need to connect to the VxRail programmatically if we want to collect further details:
Now that we know what to look for, how can we do it programmatically, and measure the time it takes to complete a command? To measure the time it takes to complete a command in PowerShell we can use the Measure-Command Cmdlet. This helpful if you are trying to decrease the time it takes to run a script by measuring each major operation and then focusing on optimizations. This is particularly important when working with numerous objects. Next, I needed to think about which PowerCLI Cmdlets might provide what I am looking for. I knew I was looking for Custom Attributes at the Cluster level. This brought the Get-Cluster Cmdlet (This tells me about a cluster), Get-Annotation Cmdlet (This tells me about Custom Attributes), and the Get-View Cmdlet (This tells me about everything) to mind. I got the quickest response using the Get-Cluster Cmdlet leveraging dot natation to get the ‘Customfields’ attribute. I tried getting the same information with the Get-View and Get-Annotation Cmdlet, as well as by using a variety of parameters, but it just wasn’t as quick.
Notice the Custom fields that VxRail Manager adds during initialization of the cluster, as shown by the results of the first command. For the second command, I timed retrieving just the property I was after:
Once you know a VxRail Manager’s IP address, you can use the VxRail API PowerShell Modules, Ansible Modules for Dell EMC VxRail, or the VxRail API directly to interact with the discovered VxRail using an appropriate account. See this post for an overview of VxRail user interfaces. To make things a bit more clear, I created a simple script to find VxRail clusters managed by vCenters:
And the result:
Want to know more, checkout education's VxRail Administration course (ID: ES124CPX00078) and come with plenty of questions. From an instructor's perspective, thoughtful questions turn training into conversations, and that benefits everyone.
Can’t get enough of my insufferable posts? Subscribe to VxRail Discussions!
Think I’m doing a borderline acceptable job? Kudos maybe in order!
Feel like commiserating, gimme a Me too!
Reply to add a compelling comment!
#NeedlessVxRailVerbosity