Customization

Automate Log Insight Content Packs with PowerCLI

LI PCLI

Not too long ago I wrote a blog article on my blog www.vtagion.com about automating the deployment and configuration of Log Insight using PowerCLI. I’ve had many people ask if there is a way to automate the import process of Content Packs as well. Is it Possible?

What is a Content Pack?

Content packs are add-on packages that can extend the capabilities of Log Insight into other products. Content packs can be found in the VMware Solution Exchange website. Some Content Packs are compressed and include other files like a readme or PDF. The file that is actually consumed and used by Log Insight is a .VLCP file.

How does your script work?

My script allows a user to place all the desired Content Packs into a target folder which is then added into the Log Insight VM. In my example I chose ‘C:\Temp\ContentPacks’. *note: The Content Packs can be placed in a folder containing other files, the script filters by the correct extension. However, I prefer to have mine organized in this way.

Screenshot 2014-07-29 12.15.04

When you login to Log Insight and go to the Content Pack page you will notice that there are two default Packs (General and vSphere). The manual/default way of adding more packs is to use the link at the bottom of that page which brings up a menu and allows you to find each pack and upload it individually. I wanted to be able to add all five of my packs at the same time.

Screenshot 2014-07-29 12.18.08

The script (which you can get by clicking HERE) only requires 3 variables:

  • $vmname – Name of the Log Insight VM
  • $LIPassword – Root password for the VM
  • $ContentPackLocation – Directory of the Content Packs

This also assumes that your PowerCLI session is already connected to vCenter.

code

In a nutshell, the script will check to make sure that the target folder exists, it will then filter by the Content Pack extension .vlcp, and for each Pack found, it will copy it into the correct directory on the VM in its own folder (CP1, CP2, CP3…).

Once all Packs have been imported, the script will restart the Log Insight service so that the Content Packs become visible in the UI (this will disconnect the user’s LI session and will require that they login again after the script has run)

Screenshot 2014-07-29 12.28.40

Upon logging in after running the script you will see all of the Content Packs are visible and ready to be used.

Screenshot 2014-07-29 12.36.14

Special thanks goes to Steve Flanders (SFlanders.net)
for answering a few questions I had about Log Insight during the write-up of this post.