8.3. Using an Answer File for the Agent Installation

It is possible to skip the setup wizard by submitting the configuration all at once. There are two ways to do this: either the agent's configuration file (agent-configuration.xml) can be edited directly or a simple text file can be passed to the agent installer.
The simplest method is to create a text file that is passed with the start script when the agent is first started that has all of the prompts answered. This mirrors the prompt questions, in order:
 agent_name  
 agent_hostname  
 agent_port  
 server_hostname  
 server_port  
 native_api_support
The final file would then resemble this:
agent.example.com
agent.example.com
16163
server.example.com
7080
native --enable
To pass the text file, use the --input option with the rhq-agent.sh|bat script:
agentRoot/rhq-agent/bin/rhq-agent.sh --input myAnswers.txt --nonative
The alternative is to edit the agent-configuration.xml directly. This offers some more flexibility because other settings (like SSL configuration) can be configured and passed with the initial setup. At a minimum, the entry keys listed in Table 8.3, “Configuration File Keys for Agent Setup” have to be set in the file.
After the configuration file is ready, then start the agent and pass the configuration file:
agentRoot/rhq-agent/bin/rhq-agent.sh --config agentRoot/rhq-agent/conf/agent-configuration.xml

Table 8.3. Configuration File Keys for Agent Setup

Installer Prompt Text Key Name Description
rhq.agent.configuration-setup-flag Tells the installer that the agent configuration is already in the configuration file. This must be set to true for the installer to load the configuration file.
[Agent Name] rhq.agent.name Gives a unique name to identify the agent to the server.
[Agent Hostname or IP Address] rhq.communications.connector.bind-address Gives the hostname or IP address that the server will use to connect to the agent. This <entry> line may need to be uncommented before it is set.
[Agent Port] rhq.communications.connector.bind-port Gives the port for the server to use to communicate with the agent. The default (16163) can be used in most cases.
[JON Server Hostname or IP Address] rhq.agent.server.bind-address Gives the hostname or IP address that the agent will use to connect to the server to register itself. If this is a hostname, it must be resolvable by the agent.
[JON Server Port] rhq.agent.server.bind-port Gives the port for the agent to use to communicate with the server. The default (7080) can be used, assuming the server was configured with the default values.
native rhq.agent.disable-native-system Enables the JNI libraries used by the agent. This enables the agent to discover and manage some types of resources using the system native libraries.