Tuesday, May 6, 2014

Deploy Hyperic Agents using vCenter Configuration Manager (vCM)

With the vC Ops Suite 5.8 you can now push Hyperic agent installations from  Infrastructure Navigator for all virtual machines (Windows/Linux), but if you need to push the Hyperic agent to physical servers then you can use vCM.  

This will require to update the zip files for both x64 and x86 install files to include the agent.properties and if you're encrypting the password you will also need to include agent.scu.  In this case I've taken the agent.properties and agent.scu from a previous installation and included them in the zip files.

Here's example preferences for configuring for auto-install of the Hyperic Agent:

x:\[install-path]\hyperic-hqee-agent-5.8.0\conf\agent.properties

[PREFS]
agent.setup.camIP=192.168.100.29
agent.setup.camPort=7080
agent.setup.camSSLPort=7443
agent.setup.camLogin=hqadmin
agent.setup.camPword=ENC(xtL6TawA/dqnXVvj6Rl5LZWjqnfkmkEB)
agent.setup.unidirectional=No
agent.setup.camSecure=Yes
Once the zip files are updated with the agent.properties and agent.scu, copy those files to the cmfiles$\Remote_Command_Files share or x:\Program Files (x86)\VMware\VCM\WebConsole\L1033\Files\Remote_Command_Files

In order to unzip the files I used 7-zip command line Version to do this.  You can download the executable below and make sure to copy it to the same path above:



Now it's time to create the remote commands in vCM.  The screenshot below shows to remote commands one for x64 and x86 systems.  I've also created a Hyperic Agent folder to keep it separated from other remote commands.


Here's the VBscript to include in the remote command:

Note: Some modifications may need to be made based on the version of Hyperic you are installing (in this case we are installing 5.8.0) and the destination of the agent (c:\Hyperic-Agent\)

Sub DoWork()
On Error Resume Next
'***Hyperic 5.8 x64 Installation***
'Name of Hyperic Agent Zip Install File:
strFilename = "hyperic-hq-agent-x86-64-win-5.8.0.zip"
'Destination to zip to:
strDest = "C:\Hyperic-Agent\"

'***Do not modify below this line***
strFolder = "hyperic-hq-agent-5.8.0"

 Err.Clear
 '********************
 ' Extract HQ Agent
 '********************
 szCMD = chr(34) & EcmAgtContext.JobDownloadDirectory & "\7za.exe x" & chr(34) & " " & strFilename & " -o" & strDest
 EcmScriptRuntime.CmdExecute szCMD, 3600

 '********************
 ' Setup HQ Agent
 '********************
 szCMD = strDest & strFolder & "\bin\hq-agent.bat install"
 EcmScriptRuntime.CmdExecute szCMD, 3600

 szCMD = strDest & strFolder & "\bin\hq-agent.bat start"
 EcmScriptRuntime.CmdExecute szCMD, 3600


 '********************
 ' Clean Downloads Dir
 '********************
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 objFSO.DeleteFolder EcmAgtContext.JobDownloadDirectory
End Sub 

To create the remote command click on the Add button

Give it a name and click next


Copy the VBScript above with your modifications to the Command Text Box and also make sure to click the Check Box


Select the 7za.exe file to unzip the agent files and the appropriate Hyperic Agent zip file for x86 or x64.  When the remote command is executed on a machine it will copy these files to the vCM agent Job Downloads folder to be executed.


Last click finish to create the new Remote Command.

Follow the same steps for creating x86 remote command if this is a requirement.

VBScript for installing Hyperic x86 agent:

Sub DoWork()
On Error Resume Next
'***Hyperic 5.8 x86 Installation***
'Name of Hyperic Agent Zip Install File:
strFilename = "hyperic-hq-agent-win32-5.8.0.zip"
'Destination to zip to:
strDest = "E:\Hyperic-Agent"

'***Do not modify below this line***
strFolder = "hyperic-hqee-agent-5.8.0"

 Err.Clear
 '********************
 ' Extract HQ Agent
 '********************
 szCMD = chr(34) & EcmAgtContext.JobDownloadDirectory & "\7za.exe x" & chr(34) & " " & strFilename & " -o" & strDest
 EcmScriptRuntime.CmdExecute szCMD, 3600

 '********************
 ' Setup HQ Agent
 '********************
 szCMD = strDest & strFolder & "\bin\hq-agent.bat install"
 EcmScriptRuntime.CmdExecute szCMD, 3600

 szCMD = strDest & strFolder & "\bin\hq-agent.bat start"
 EcmScriptRuntime.CmdExecute szCMD, 3600


 '********************
 ' Clean Downloads Dir
 '********************
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 objFSO.DeleteFolder EcmAgtContext.JobDownloadDirectory
End Sub 


Next steps are to select the machines you want to deploy for x64 or x86 (you can use dynamic machine groups or the column grouping option in the Machines Datagrid to filter the machine types).  Once the remote command is finished running verify in the Hyperic UI that the machines have checked in and are ready for auto-discovery.

No comments:

Post a Comment