Are you using the wrong vCenter credentials?

by tekwurx

A requirement emerged recently to ensure that virtual machine tags were captured as part of discovery to enhance and update “non-discoverable” data.

This included such things as:

  • Line of Business
  • Support Group
  • Business Application
  • Service Line
  • Location
  • Backup Strategy

A quick search within BMC Discovery showed that tags were not being captured and therefore, as consultants would, our first thought was custom TPL. A pattern to extend discovery via vCenter to capture tags assigned to a Virtual Machine instance.

While looking for information on the correct calls via vCenter to return all tags assigned to an object and the format of how this data is returned we stumbled across this nugget of information:

https://docs.bmc.com/docs/display/Configipedia/Technology+Knowledge+Update+TKU+2019-Nov-1

The functionality to collect the VMware vSphere Tags already exists in BMC Discovery – you just need to configure the correct credential type to activate it!

Adding the Credentials

Having always been used to requesting the standard vCenter credentials a quick check of the Credentials page within BMC Discovery now shows the following (after applying Nov 2019 TKU):

All that was required was to edit the existing vCenter credential within BMC Discovery and add this as a credential type:

On the next scan when you look at the Discovery Access page for the vCenter Server / Appliance you should see additional discovery containing restfulGet and restfulPost:

Using the data in a report query

Now that we have the data, naturally we want to use this in a report query – one of the things you will quickly find is that the TKU pattern pulls these tags into a table and sets the table as an additional attribute on the Virtual Machine node.

Therefore when you run the query Search VirtualMachine show SUMMARY, tag_set it returns the Key Pair name rather than value – so rather than getting the data in your report you just have a column of comma separated tag names.

When looking at the TKU pattern the function not only creates the table and stores the tags as key pair values it also loops through the tags and creates a dynamic attribute on the Virtual Machine node for each tag – in the format of tag_tagname. For those that use the UI debug option you can see these as:

So the report you would write to show the data is Search VirtualMachine show SUMMARY, tag_DMZ, tag_Division, tag_Environment, tag_Location, tag_OS

Top