So you just implemented the vRealize Suite and you want to make sure any Linux VM you deploy get’s added to Log Insight right? Well look no further you came to the right place.
Pre-Reqs you need in place for this integration to work:
- vCAC 6.0, 6.1 or vRA 6.2 installed and configured
- vRealize Log insight 2.5 installed and configured
- Linux Guest agent template see my guide here
- An NFS server with a script directory available for you to run scripts and install software from
- A quite place to work for a few hours where you will not be interrupted.
Let’s get started: Power on your Linux guest agent template and login as root or sudo to root and create directory on the root file system named repo. This is where you will mount your NFS share to.
Next, create a file named repomount.sh using the vi editor with the following content and save it.
mount -t nfs $1:$2 /repo &>/repomount.log
Make the repomount .sh executable by typing the following then pressing enter
chmod u+x repomount.sh
Note: Depending on your Linux installation you may not have the nfs-utils package. You can instal it manually on the template image or add it to your repomount.sh file. You should test your repomount script to make sure it works prior to shutting down the template.
yum -y install nfs-utils
Now shutdown your template. If you are using Linked clones you will also need to take a new snapshot and then run an inventory scan in vCAC and update the blueprint to point to the new snapshot. See here for instructions.
Now we need add the necessary files and scripts to the NFS share. First we will need to get the Linx RPM based agent from Log Insight server. Log into the vRealize Log insight portal then go to the administration page and agents and click Download Log Insight Agent version 2.5
Now we need to create the script that will install the agent and register it with the vRealize Log Insight server. create a new file named vrlogagentinstall.sh using the vi editor
vi vrlogagentinstall.sh
Enter the command in the following format. Notice that server host is a variable $1 and the RPM name needs to match what you downloaded from the Log Insight server with the path relative to repo which we will mount as part of the vRA provisioning process. When done press ESC and then hold down shift and pres zz and hit enter to save the file.
SERVERHOST=$1 rpm -i /repo/VMware-Log-Insight-Agent-2.5.0-2347850.noarch.rpm
Now let’s create the build profile for this blueprint to use. Login to vCAC and navigate to the Infrastructure tab, then Blueprints, then Build Profiles and click to create a new build profile.
Now create the following build profile
LogInsight.Server vrlog-01a.corp.local repo.path /scripts repo.server yourNFSServer VirtualMachine.Admin.UseGuestAgent true VirtualMachine.Customize.WaitComplete true VirtualMachine.Software0.Name repomount.sh VirtualMachine.Software0.ScriptPath /repomount.sh {repo.server} {repo.path} VirtualMachine.Software1.Name vrlogagentinstall.sh VirtualMachine.Software1.ScriptPath /repo/vrlogagentinstall.sh {LogInsight.Server}
Now navigate to your Linux guest agent blueprint and attach this build profile to it and save it.
What this integration will actually do: It will call the repomount.sh script to mount the NFS share on the server you specify and to the directory you specified. It will mount that NFS share to the /repo directory in the guest. Next it will execute the script you specified that is in the NFS share to install the Log Insight agent. It will pass the Log Insight server to the RPM installer so if you ever need to change log insight servers you can update the property in the build profile.
Let’s just recap what we did:
- We created a Linux blueprint with the vCAC guest agent installed and configured
- We added a repomount script to the Linux template that will mount a repo directory where a develper could call whatever scripts they want in the guest
- We created a custom build profile that will install and configure the Log Insight agent from an NFS share.
- We requested a new VM with this build profile
- Verified the script ran and installed and configure the Log Insight Agent by viewing the Log Insight web portal.
Pingback: Newsletter: February 15, 2015 | Notes from MWhite