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 ESXi 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 ESXi, for example a VMkernel module or a custom ESXi 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 ESXi 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 instance.

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.

Prerequisites

Download the vSphere ESX Agent Manager SDK.

Procedure

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

    Your solution can define the configuration and creation of ESX agencies and agents in the MyAgentHandler.java class.

    public MyAgentHandler(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.
    Your solution can define ESX agents for ESXi 6.7 and for ESXi 7.0.
    public AgentHandler([...]) {
       [...]
       _agentConfigInfo67 = new AgentConfigInfo();
       _agentConfigInfo70 = 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.
    Your solution can construct the URLs to OVF files from information that you set in the mysolution .properties file.
    public MyAgentHandler([...]) {
       [...]
    
       _agentConfigInfo67.setOvfPackageUrl(urlPrefix + ovfUrl4x);
       _agentConfigInfo70.setOvfPackageUrl(urlPrefix + ovfUrl50);
    
       [...]
       }
  4. (Optional) Set the URLs to the optional VIB files from which the solution adds functions to ESXi by calling the AgentConfigInfo.setVibUrl() method.
    Your solution can construct the URLs to VIB files from information that you set in the mysolution.properties file.
    public MyAgentHandler([...]) {
       [...]
    
       _agentConfigInfo4x.setOvfPackageUrl(urlPrefix + ovfUrl4x);
       _agentConfigInfo50.setOvfPackageUrl(urlPrefix + ovfUrl50);
    
       if (deployVibs) {
          _agentConfigInfo67.setVibUrl(urlPrefix + vibUrl4x);
          _agentConfigInfo70.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.
    Your solution can set some dummy properties in the eamri-webapp.xml file.
    public MyAgentHandler([...]) {
       [...] 
       AgentOvfEnvironmentInfo ovfEnv = new AgentOvfEnvironmentInfo();
       for (final Map.Entry<String, String> entry : ovfEnvironment.entrySet()) {
          ovfEnv.getOvfProperty().add(new AgentOvfEnvironmentInfoOvfProperty() {
             {
                setKey(entry.getKey());
                setValue(entry.getValue());
             } 
          });
       }
       _agentConfigInfo67.setOvfEnvironment(ovfEnv);
       _agentConfigInfo70.setOvfEnvironment(ovfEnv);
       [...]
    }
  6. Create an instance of AgencyConfigInfo to define the ESX agency that the solution deploys.
    public MyAgentHandler([...]) {
       [...] 
    
       _agencyConfigInfo = new AgencyConfigInfo();
       [...]
    }
  7. Provide names for the ESX agency and the ESX agents by calling the AgencyConfigInfo.setAgencyName() and setAgentName() methods.
    Your solution can name the ESX agency and the ESX agents My Service.
    public MyAgentHandler([...]) {
       [...] 
    
       _agencyConfigInfo = new AgencyConfigInfo();
       _agencyConfigInfo.setAgencyName("My Service");
       _agencyConfigInfo.setAgentName("My Service");
       [...]
    }
  8. Add an array of ESX agent configurations to the ESX agency configuration by calling the AgencyConfigInfo.getAgentConfig() method.
    public MyAgentHandler([...]) {
       [...] 
    
       _agencyConfigInfo = new AgencyConfigInfo();
       _agencyConfigInfo.setAgencyName("My Service");
       _agencyConfigInfo.setAgentName("My 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 your solution can set the scope of the ESX agency by selecting ESXi hosts from your solution Configuration page. Consequently, the scope is empty until your solution updates it according to the user interaction.
    public MyAgentHandler([...]) {
       [...] 
       _agencyConfigInfo.setScope(null);
       [...]
    }

Results

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

What to do next

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