Red Hat Training

A Red Hat training course is available for Red Hat JBoss Operations Network

7.3. Changing the Agent Configuration After an RPM Install

There are two parts to the agent configuration:
  • The agent connection properties, which define the agent instance and how it communicates to the server
  • The agent JVM properties, which manage agent performance and options

7.3.1. Changing Agent Connection Configuration

The agent connection properties are defined when the agent is installed. This includes information like the server for it to connect to, its port number, and whether to use SSL connections.
That agent connection configuration is initially read from agent-configuration.xml and overlaid with the values entered at the setup prompts at start up. After the agent is initially configured, the agent persists that configuration in its Java preferences (/var/lib/jboss-on/agent/prefs/.java/.userPrefs/rhq-agent/default/) and never refers to the agent-configuration.xml again.
For that information to be changed, the agent connection information has to be wiped out and reset.
To change the agent connection (registration) configuration, use the config service command to run through the setup options again. This cleans out the preferences store, re-reads the agent-configuration.xml file, and runs through the configuration setup again.
Important
When the JBoss ON agent is installed from an RPM, it is automatically configured as a system service. For data consistency and agent performance, always manage the agent connection configuration using the service tools, rather than attempting to edit the configuration files or JVM startup properties directly.
For example:
[jsmith@server ~]$ sudo service jon-agent config
RHQ 4.4.0.JON311GA [6910991] (Wed Aug 01 18:43:03 EDT 2012)
** Advanced Setup **
Agent Name [agent.example.com] : agent1
Agent Hostname or IP Address [!*] :
Agent Port [16163] :
Agent Transport Protocol [socket] :
... 8< ...
The config service command opens the agent start script and automatically passes a series of options which edit the agent connection configuration:
  • --cleanconfig, to wipe the previous configuration settings
  • --setup and --advanced, which force the agent to run its configuration setup again
  • --daemon and --nostart, which runs the agent command prompt without starting the agent process and then exits (so that the agent can be started as a service)
So, the service jon-agent config command is equivalent to starting the agent with all those options:
rhq-agent.sh --cleanconfig --setup --advanced --daemon --nostart

7.3.2. Changing Agent JVM and Other Init Configuration

After the agent is configured, optional JVM settings (the persisted configuration) are set in the init script, /etc/init.d/jon-agent file, or in the environment script, rhq-agent-env.sh. Both files are loaded every time the agent starts; it is recommended to edit the init script, which sets the additional JAVA_OPTS values.
For example:
RHQ_AGENT_ADDITIONAL_JAVA_OPTS="-Drhq.agent.data-directory=$RHQ_AGENT_DATA_DIR -Djava.util.prefs.userRoot=$RHQ_AGENT_PREFS_DIR -Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true"
export RHQ_AGENT_ADDITIONAL_JAVA_OPTS
The Java settings can also be edited using agent prompt commands like setconfig. This is described in Configuring JBoss ON Servers and Agents.