5.4. Migrating from a JAR Installation to an RPM Installation

When an agent is initially installed from the JAR file available with the JBoss ON server downloads (Chapter 4, Installing and Upgrading an Agent on a Managed Platform from the JAR File), it is possible to switch the agent to an RPM installation. There are two potential paths. Either the old agent can be scrapped and a new agent installed (which loses all of the original agent configuration and data) or the agent data can be migrated from the original JAR installation to the new RPM installation.

5.4.1. Converting an Agent (Losing Configuration Data)

This method loses all of the original data for the agent, including the persistent store, data directory, and logs. However, by re-using the original security token, the agent can re-register with the server and retrieve its previous inventory and resource histories and configuration, so none of the management information for the platform is lost.
  1. Retrieve the security token for the agent.
    1. Click the Administration tab and select the Agents link under the Topology section on the left.
    2. Select the agent from the list, and click its name to open its details page.
    3. Copy the security token.
  2. Shut down the agent.
  3. Remove the JAR installation directory.
  4. Install the agent RPM.
  5. Edit the agent-configuration.xml file and add a line for the original security token for the agent.
    vim /etc/jboss-on/agent/agent-configuration.xml
    						
    <entry key="rhq.agent.security-token" value="abcd1234" />
  6. Run through the agent configuration installer.
    [jsmith@server ~]$ sudo service jon-agent config
  7. Start the agent.
    [jsmith@server ~]$ sudo service jon-agent start

5.4.2. Migrating an Agent to an RPM (Preserving Configuration Data)

It is possible to preserve the JVM and persisted data for the agent, which maintains all of the original configuration data. However, this requires accessing the Java store through a Java preferences browser in the original agent and copying it into the Java store for the new agent, without affecting any other data in the store. There is always a risk when editing Java stores.
  1. Shut down the original agent.
  2. Install the agent RPM.
  3. Copy over the previous configuration directories for the agent. This includes the data directory (which contains operational information like the changesets for drift detection or truststores used for SSL) and the log directory. For example:
    [root@server ~]# cp -r agentRoot/rhq-agent/data/ /var/lib/jboss-on/agent/data/
    [root@server ~]# cp -r agentRoot/rhq-agent/logs/ /var/log/jboss-on/agent/
  4. Using a Java preferences editor, export the Java preferences specific to the agent from the original preferences store in ~/.java/.userPrefs/rhq-agent/default (by default).

    Note

    Be sure to retrieve the security token. The token allows the agent to re-register with the server successfully.
  5. Using a Java preferences editor, import the Java preferences for the agent into the new preferences store in /var/lib/jboss-on/agent/prefs/default (by default).
  6. Run through the agent configuration installer.
    [jsmith@server ~]$ sudo service jon-agent config
  7. Start the agent.
    [jsmith@server ~]$ sudo service jon-agent start