vCloud Automation Center – vCAC 5.1 – Example CMDB Integration

I keep getting asked for an example of integrating into a CMDB. The challenge with this is which CMDB, Asset, or Ticketing system do you create an example around. They are all very different and most organizations have heavily customized them. My solution was to create a sample system to demonstrate vCAC’s capabilities and leave the specifics of any particular CMDB out of the equation.

In this tutorial I’m going to show you how to integrate vCAC 5.1 into an external system of your choosing. In my example I’m using a simple SQL database with a very simple web front end. My workflow is going to call a PowerShell Script that uses SQL statements to update the database with the value I want populated. Now you can take this and have execute code to talk to a specific API or database, btu the point is how to get the data you want from vCAC when you want it and make it usable to push to another system.

I have provided my sample database, web front-end, Workflows,and Scripts download here.

Installing the sample CMDB

Once you have downloaded the “CMDBExample.zip” follow the below instructions to install.

  1. You will need to have “SQLCmd.exe” on your “server. If you do not have it, install the SQL Management Studio and that should install it for you. Once you are done make sure to re-boot and verify that you can open and CMD prompt and run “sqlcmd.exe” to validate the path exists.
  2. Note: I have only tested this on a vCAC server.

  3. Open a “PowerShell” Console, make sure your “RemoteExecutionPolicy” is set to “remoteSigned“. the navigate to the extracted files from the CMDBExample.zip.
  4. Run the installer by typing “./InstallCMDB.ps1 {hostname of SQL Server}
  5. The installer will perform the following:

    1. Create the SQL Database & Tables
    2. Update PowerShell Scripts for the database server you entered
    3. Load the PowerShell scripts into the repository
    4. Update the Workflow Stubs in the repository
    5. Copy the CMDB website
    6. Update database connection in CMDB web.config for database you entered
    7. Create the IIS Application for the CMDB web interface

    There are three Powershell Scripts that get imported into the repository. AssetCreate, AssetExpire, and AssetDestroy. Check them out. The most important part to take note of is at the top where the vCAC properties are being assigned to variables. Once you have access to your property values the rest of the code can be what you want it to be – SQL Queries, API Calls, Whatever you need.
     
    vcaccmdb-11

  6. Next we need to import the property sets that contain the custom properties for the integration. Go to “Enterprise Administrator” and select “Build Profiles” then select “New Build Profile“.
  7.  
    vcaccmdb-1

  8. When the “New Build Profile” page opens select “Manage Property Sets” in the upper right corner.
  9.  
    vcaccmdb-2

  10. Scroll down to the bottom and then browse for the Property Set named “CMDB_Data_Properties.xml” included with the “CMDBExample.zip“.
  11.  
    vcaccmdb-3

  12. Provide a “Name” and optionally a description for the property set and click “Ok
  13.  
    vcaccmdb-4

  14. Repeat steps 6-7 and import the “CMDB_Workflow_Properties“. Once finished you will see both sets listed under “Existing Property Sets“. Click “Back To Build Profile
  15.  
    vcaccmdb-5

  16. Give the “Build Profile” a “Name” and then from the drop down list select “CMDBDataProperties” (Or whatever you named it) and click “Load“. Repeat this step and select the “CMDBWorkFlowProperties” and click “Load“.
  17.  
    vcaccmdb-6

  18. Now edit the “Values” of the properties to what you like and click “Ok” to save the “Build Profile“.
  19.  
    Note: If you look at the properties included in this example, there is a property named “Datacenter”. The same same property I used in my “Relational Drop Down List” example. By assigning it a vlaue I’m going to make it the default choice in the drop down list. Users can still change it, but this will be the default choice selected on the request page.
     
    vcaccmdb-7

  20. Add the “Build Profile” to whatever blueprint you like and make a “New Request“. When the machine get’s to the “MachineProvisioned” state it will create the asset in our database. Open “http://{host}/CMDB” to see the machine listed.
  21.  
    vcaccmdb-8
     
    CMDB Listing:
    vcaccmdb-10

  22. On “Expire” the status of the machine will update to “Expired” and on “Destroy” the status will update to “Destroyed
    1. In this example we have all the properteis in a build profile which isn’t very useful. Taking the properties and placing them throughout vCAC gives it much more value. Here is I use the properties in this example:

      • CostCetner – I define this at the Provisioning Group and either define or prompt user. This way I get the cost code based on the group it was requested under.
      • Datacenter – I define this at the Compute Resource because compute resources are clusters or hosts tied to physical hardware located in a datacenter.
      • HostingPlatform – I define this at either the endpoint or the Compute Resource. Compute Resousrce is flexible, vCenter endpoint might manage different versions of vSphere.
      • ProjectID – I define where ever it makes sense at the time. I usually prompt user unless there are specific blueprints or a group for a project then I define the projectID value.
      • ServiceTier – I typically define this at the reservation.
      • VirtualMachine.Admin.Department – I define this at the Provisioning Group, could also do a drop down to have user pick.
      • VirtualMachine.Admin.OS – I define this at the blueprint.

      I usually then create a build profile to enable the CMDB on a blueprint and define the workflow properties in the build profile.
       
      For information on modifying a workflow stub to execute PowerShell scripts see my article “vCloud Automation Center – vCAC 5.1 – Workflow Designer Walk-Through – Add Computer Account to Active Directory OU“.

5 Replies to “vCloud Automation Center – vCAC 5.1 – Example CMDB Integration”

    1. Awesome. I am working on building an installer for an external IPDB example I have. Should hopefully be available by mid next week. I have been busy delivering training this week.

  1. Thanks for sharing. Is there any way we can edit/add a new entry in the cmdb for any VM reconfigurations. End users are able to reconfigure their VM’s with respect to cpu, memory and strorage and new modified VM configuration needs to be captured in CMDB.
    I see only stubs for Provisioned/Expiring/Disposed etc, nothing for reconfiguration.

Leave a Reply