This is the second post in a series on how to use PowervRNI to manage Applications within your vRealize Network Insight environment. If you’d like to learn about managing Data Sources with PowervRNI, check here.

Applications

Introduced in vRealize Network Insight 3.2 in the begin of 2017, Applications are logical containers which can contain the structure of applications (including tiering). You can use these application containers to better visualize what network flows are going between specific applications or even application tiers. Next to insights into your applications, you can also use it to take a per-application approach to micro-segmentation, using the planner feature in Network Insight.

The first thing you should know is that the application container has a few concepts to it. The application itself, then tiers that make up the application (for instance, the easy 3 tier app: Web, App and Database tiers) and inside the tiers there are rules that determine what VMs will be placed in that tier. These rules can be based on the same criteria as you can use in the search engine, so you can get really creative. Below is a visual explanation of the different concepts:

Creating Applications with PowervRNI

So, to automate the creation of the application you need to be able to create applications, then the tier and the rules that will place VMs into the tiers. Here are the cmdlets in PowervRNI which will help:

  • Get-vRNIApplication
  • Get-vRNIApplicationTier
  • New-vRNIApplication
  • New-vRNIApplicationTier
  • Remove-vRNIApplication
  • Remove-vRNIApplicationTier

To create a new application, first use New-vRNIApplication to create the container and then New-vRNIApplicationTier to fill that container.

Using New-vRNIApplication

An application is just an empty container, so creating it is easy and straightforward:

That’s it. The return value is the Application object, which contains the newly created entity id and a few other details. After running this, you can verify using the interface:

Using New-vRNIApplicationTier

Once you have an application container, you can define the tiers. Due to some limitations of the current vRNI API, you can currently only use VM names and NSX Security Groups to define the tier membership. Below is an example that uses both VM names and security groups:

I’ll go through what happened here step by step:

  1. First, we find the entity ID of the security group called SG-3Tier-Web and store it in $security_group_id
  2. Then we use New-vRNIApplicationTier to create a new tier called Web-Tier with 2 rules:
    • Put in all VMs where the name begins with 3TA-Web0
    • Put in all VMs that are in the security group called SG-3Tier-Web

If you then validate this in the interface, you’ll see a newly added Web-Tier with the provides rules in it. You’ll also notice that there’s a “2 Vms” behind the rule. This is because I have 2 VMs called 3TA-Web01 and 3TA-Web02. Both are also in the security group ST-3Tier-Web.

Adding in Bulk

Using the cmdlets described above is pretty quick, but imagine doing that a couple 100-times in a greenfield environment. Not fun.

With that in mind, I’ve put up an example on how to import a lot of applications at once in the examples/ directory called: application-bulk-import.ps1

Similar to the data source bulk import script, the application bulk import script uses a CSV file as input. The CSV file has the applications, tiers and security groups and/or VM names in it. Here’s an example of how it should be formatted.

* Yes, it’s technically not a CSV as I used β€˜;’ for the separations. But this way Excel can read it into columns. πŸ˜‰

As you might notice, the same Application can contain multiple lines. This is because each line represents an application tier and you can have multiple tiers in 1 single application. You can use either the Security Group or VM Names column to create the filters, or you can use both columns if the VMs need to have a certain name and be a member of a specific security group.

Usage

Once you have the CSV filled with data, you can run the script as follows:

 

That’s it! Let me know if you have any questions. PowervRNI can be found on GitHub and on twitter for the latest news.

 



Share the wealth!

Leave a Reply

Your email address will not be published. Required fields are marked *