You must define the configuration of the ESX agencies in the implementation of the solution. You set the configuration for ESX agencies and ESX agents in the AgencyConfigInfo and AgentConfigInfo data objects.

When you create ESX agencies, you provide the AgencyConfigInfo object with an array of AgentConfigInfo objects for each version of ESX Server on which the agency deploys ESX agents. You also define the name of the ESX agency and of the ESX agents and the scope of the ESX agency in the AgencyConfigInfo object.

You define the deployment of the ESX agent virtual machines in the AgentConfigInfo object. You set the following information in the AgentConfigInfo object.

A URL to the Open Virtualization Format (OVF) file from which to deploy the ESX agent.

A URL to an optional vSphere Installation Bundle (VIB) that adds function to the ESX Server, for example a VMkernel module or a custom ESX application that you developed.

The URL to the ESX agent virtual machine OVF and the URL to an optional VIB must lead to a server that ESX Agent Manager can access. ESX Agent Manager downloads the ESX agent virtual machine from the URLs that you provide and deploys the virtual machines on the ESX hosts. ESX Agent Manager installs one ESX agent instance per agency per host.

Note

To install VIBS, all ESXi hosts must have configured the firewall so that they can access the HTTP port on the vCenter Server.

Setting the ovfEnvironment property allows a solution to provide OVF properties specific to the ESX agent virtual machine. ESX Agent Manager sets the OVF properties when it deploys an ESX agent. A typical use of the ovfEnvironment field is to specify the IP address and credentials of the solution so that ESX agents can connect back to the solution when they are running.

Download the vSphere ESX Agent Manager SDK.

Verify that you have set up and started the EAM Sample Solution in an application server.

Open eam_work_folder\src\com\vmware\eam\sample\solution\AgentHandler.java in a text editor.

1

Create a program to configure and create ESX agencies and agents.

The EAM Sample Solution defines the configuration and creation of ESX agencies and agents in the AgentHandler.java class.

public AgentHandler(String selfUrl,
                    String selfIp,
                    String ovfUrl4x,
                    String ovfUrl50,
                    String vibUrl4x,
                    String vibUrl50,
                    boolean deployVibs,
                    Map<String, String> ovfEnvironment,
                    VcUtils vcUtils) {
   _vcUtils = vcUtils;

   _agentConfigInfo4x = new AgentConfigInfo();
   _agentConfigInfo50 = new AgentConfigInfo();

   [...]
}
2

Create AgentConfigInfo instances for each type of ESX agent that the ESX agency deploys.

The EAM Sample Solution defines ESX agents for ESX Server 4.x and for ESX Server 5.0.

public AgentHandler([...]) {
   [...]
   _agentConfigInfo4x = new AgentConfigInfo();
   _agentConfigInfo50 = new AgentConfigInfo();
   [...]
}
3

Set the URLs to the OVF files from which the solution deploys ESX agent virtual machines by calling the AgentConfigInfo.setOvfPackageUrl() method.

The EAM Sample Solution constructs the URLs to OVF files from information that you set in the eamri.properties file.

public AgentHandler([...]) {
   [...]

   _agentConfigInfo4x.setOvfPackageUrl(urlPrefix + ovfUrl4x);
   _agentConfigInfo50.setOvfPackageUrl(urlPrefix + ovfUrl50);

   [...]
   }
4

(Optional) Set the URLs to the optional VIB files from which the solution adds functions to the ESX Server by calling the AgentConfigInfo.setVibUrl() method.

The EAM Sample Solution constructs the URLs to VIB files from information that you set in the eamri.properties file.

public AgentHandler([...]) {
   [...]

   _agentConfigInfo4x.setOvfPackageUrl(urlPrefix + ovfUrl4x);
   _agentConfigInfo50.setOvfPackageUrl(urlPrefix + ovfUrl50);

   if (deployVibs) {
      _agentConfigInfo4x.setVibUrl(urlPrefix + vibUrl4x);
      _agentConfigInfo50.setVibUrl(urlPrefix + vibUrl50);

      [...]
   }
}
5

Set any OVF environment properties that the solution requires by creating an instance of the AgentOvfEnvironmentInfo object and passing it to the AgentConfigInfo object for each ESX agent.

The EAM Sample Solution sets some dummy properties in the eamri-webapp.xml file.

public AgentHandler([...]) {
   [...] 
   AgentOvfEnvironmentInfo ovfEnv = new AgentOvfEnvironmentInfo();
   for (final Map.Entry<String, String> entry : ovfEnvironment.entrySet()) {
      ovfEnv.getOvfProperty().add(new AgentOvfEnvironmentInfoOvfProperty() {
         {
            setKey(entry.getKey());
            setValue(entry.getValue());
         } 
      });
   }
   _agentConfigInfo4x.setOvfEnvironment(ovfEnv);
   _agentConfigInfo50.setOvfEnvironment(ovfEnv);
   [...]
}
6

Create an instance of AgencyConfigInfo to define the ESX agency that the solution deploys.

public AgentHandler([...]) {
   [...] 

   _agencyConfigInfo = new AgencyConfigInfo();
   [...]
}
7

Provide names for the ESX agency and the ESX agents by calling the AgencyConfigInfo.setAgencyName() and setAgentName() methods.

The EAM Sample Solution names the ESX agency and the ESX agents Sample Service.

public AgentHandler([...]) {
   [...] 

   _agencyConfigInfo = new AgencyConfigInfo();
   _agencyConfigInfo.setAgencyName("Sample Service");
   _agencyConfigInfo.setAgentName("Sample Service");
   [...]
}
8

Add an array of ESX agent configurations to the ESX agency configuration by calling the AgencyConfigInfo.getAgentConfig() method.

public AgentHandler([...]) {
   [...] 

   _agencyConfigInfo = new AgencyConfigInfo();
   _agencyConfigInfo.setAgencyName("Sample Service");
   _agencyConfigInfo.setAgentName("Sample Service");
   _agencyConfigInfo.getAgentConfig().add(_agentConfigInfo4x);
   _agencyConfigInfo.getAgentConfig().add(_agentConfigInfo50);
   [...]
}
9

Set the scope of the ESX Agency by calling the AgencyConfigInfo.setScope() method.

Users of the EAM Sample Solution set the scope of the ESX agency by selecting ESXi hosts from the EAM Sample Solution Configuration page. Consequently, the scope is empty until the EAM Sample Solution updates it according to the user interaction.

public AgentHandler([...]) {
   [...] 
   _agencyConfigInfo.setScope(null);
   [...]
}

You set the configuration properties for an ESX agency and the ESX agents that it contains.

Call the createAgency() method to create the ESX agency.