In a previous post, Integrating vRealize Automation with Network Insight, I covered how greenfield applications can be automatically pushed into vRealize Network Insight to provide application context with the analytics of Network Insight. This post is about importing brownfield into Network Insight to get insights into the behavior of your existing applications. Specifically, importing CMDB information from ServiceNow.
Disclaimer: This is something I built, it is not officially supported by VMware.
In the case of existing applications, your Configuration Management Database (CMDB) should be your source of truth. There are a lot of CMDB products out there, but ServiceNow (SNOW) is a popular one that a lot of organisations use. That’s why this example is based on that specific CMDB, but this can apply to any and all CMDBs. As long as you have the ability to export data or retrieve data from an API; this will work.
Honestly, there are not many requirements on the SNOW side for this to work. The only thing this procedure will depend on is that there are application constructs which have relationships towards the VMs that host the application. There doesn’t have to be a specific hierarchy in the relations, they only need to exist. Here’s an example of a relationship tree (as seen through the SNOW dependancy viewer):
I have declared a top-level application, attached that to a Web Tier which runs on 2 VMs. Those 2 web VMs make use of the App Tier, which runs on 2 App VMs. Finally, those 2 App VMs make use of a DB Tier, which runs on a single VM.
The script I’ve published below takes this tree and translates it into Network Insight application constructs. The only thing to take note of is that it uses the naming scheme of the VM to determine the name of the tier. For example; with VM VMworld-3TA01-Web-01, the tier will be named Web (it uses the second to last field when split on the character “-“). If you want to change that syntax, have a look at line 56.
You will see a common thread throughout my automation posts; PowerShell. 😉 This script is no different and uses PowervRNI to simplify talking to Network Insight. That means PowervRNI is a requirement, it’ll fail if you don’t have it installed (Install-Module PowervRNI).
Before running the script, edit it to reflect your environment. It doesn’t take parameters just yet, so configure your SNOW and Network Insight details on the top of the script:
## Start editing here ##
# ServiceNow configuration; login credentials & URL
$CONFIG_SNOW_USER = "admin"
$CONFIG_SNOW_PASS = "VMware!"
$CONFIG_SNOW_URL = "//myinstance.service-now.com"
# vRealize Network Insight config; login credentials & URL
$CONFIG_vRNI_SERVER = "platform.networkinsight.lab.local"
$CONFIG_vRNI_USER = "[email protected]"
$CONFIG_vRNI_PASS = "VMware1!"
# We're using a filter to find only applications in ServiceNow with this in its name
$APP_FILTER = "VMworld"
## Stop editing here ##
After editing those variables, you’re free to run it. It will spew out errors and grind to a halt if any of those variables are incorrect. 😉
When running the script, it will tell you what it discovers and what it’ll add it to Network Insight. Here’s an example of how it can look:
If you would like to see whether this is even going to work for you, have a look at the demo I’ve put together. You’ll be able to get a detailed view of what’s in SNOW which gets exported. If there’s anything that would block you from exporting it this way (for instance, you have a different configuration inside SNOW), please let me know!