«

»

Jul 05

Fully Automated Deploy & Config of Log Insight 2.0

First off, please forgive the crazy alignment in this post. New theme is not working properly yet. 🙂

 

Although there are several blog posts out there right now on how to deploy Log Insight 2.0 I wanted to go ahead and post what I’ve done with it since I know there are others who would like to deploy and configure Log Insight completely without any human interaction.

What does your script do?

  1. Deploy’s the OVA with all necessary properties
  2. Adds the license key
  3. Adds Log Insight configuration
  4. Includes configuration for vCenter/ESXi hosts
  5. Includes configuration for vCOPS
  6. Includes encryption function for passwords

This script is actually a compilation of a few functions and code from others that I have tweaked to make this work. Those that I have leveraged need ample appreciation:

  • William Lam – Base configuration was created from his initial post about Log Insight 2.0 (HERE)
  • Ben Sier – Tweaked an encryption function to work with Log Insight
  •  Alan Castonguay – Pointing me to the license key location in Log Insight
  • Clint Kitson – Fantastic OVA deployment function

Now, how does it work?

There are a couple of pre-reqs.

  • PowerCLI must be installed. (I haven’t tested with anything lower than v5.1 but lower should still work)
  • OVFTool 3+ must be installed
  • Log Insight 2.0 binary

Fill in the required variables at the top of the script. If the datastore is left empty it will choose a datastore for you. Choose a TempDirectory ($TempDir) and place the OVA in that folder. The folder will be used for sevveral things throughout the script.

Screenshot 2014-07-05 16.31.01The script will add and configure the vCenter hosts with Log Insight. The tricky part of this that we had to overcome is that the vCenter password is saved as an encrypted string within the LI script. Big Kudos to Ben Sier (VMware SE) for taking the time to get this part working with me. There is a function included in the script that will take the $VCPass variable and throw out the encrypted string.

The script will also add and configure itself with vCenter Operations Manager. This too requires the encrypted string of the vCOPS admin password. We use the same method as with vCenter to get past this. (If you do not plan on using vCOPS in your deployment, simply open the script and delete out all the lines between the <VCOPS></VCOPS>.

Once you have placed the Binary in the TempDir folder (that you specified in your script) and you defined the variables, sit back and run it and watch the magic :). The script will connect to vCenter, upload the binary with the values pre-defined for each OVA Property. Once LI uploads it will power on. After 10 minutes (Different HW will allow LI to boot faster than others, you may need to change the timeout to be 15 minutes or as little as 8. Play with it and find your environment’s sweet spot) we run a copy-vmguestfile command to move our LogInsight script that gets generated over into the VM, we run CHMOD to make sure it has the correct permissions for us to run it remotely, and then we run an invoke-vmscript command and kick it off. All of this takes place as LogInsight is still loading for its first time. Once the script finishes you’ll need to wait for the VM to load completely. You should then be able to go to the IP address that you gave it and you should see that you are already receiving logs from your ESX hosts and see the vCOPS integration.

Screenshot 2014-07-05 17.36.50

Cool huh? It’s awesome what a bunch of people collaborating together can pull off! 🙂

You can get the script HERE on my GitHub account.

ps. The XML script can be tweaked to your liking. The XML file is generated by Log Insight as you go through the web interface to set it up. The file is then stored in /storage/core/loginsight/config/loginsight-config.xml#(revisionnumber) If my xml script doesn’t do what you need it to you can generate your own through the web interface, then replace the corresponding variables with the variables in my script.

2 comments

  1. Sarika

    Thanks for the post. Is there any way to encrypt vCenter/ vROPS password (for storing it in config xml file) using shell script and not PowerCLI?

  2. Jesper Baunbæk

    Hi Brian
    Have you tried this with 3 or the new 3.3?
    Regards
    Jesper

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

13 − eleven =