2.3. The rhqctl Control Script

JBoss Operations Network has a control script which is used for basic lifecycle management for the server and storage nodes. It can open a server console, start and stop an instance, and install or upgrade components.
The rhqctl script has subcommands and options:
rhqctl [command] [[options]
The option usually specifies what local instance to perform the task on, --server, --agent, or --storage.

Example 2.1. Installing Specific Services

The install command configures the JBoss ON server, storage node, and agent all at the same time.
While it is recommended that all three management services be run on the same system (and from the same parent directory), there may be some environments where it is beneficial to run the JBoss ON server on a separate machine from the storage node. In other cases, it may be required to install the different services at different times.
The install command has options for each service. If that option is used, the only that service is installed; the other services are excluded.
For example, this installs the server, storage node, and agent in three separate command invocations:
[root@server bin]# ./rhqctl install --storage --start
[root@server bin]# ./rhqctl install --server --start
[root@server bin]# ./rhqctl install --agent --start
After a server or a node is installed, the rhqctl command is used to start and stop the instance, so start/stop commands are the most common ones to use. Running a command with no options runs that command for all JBoss ON instances on the system.
[root@server bin]# ./rhqctl start
Using an option runs that command only for that instance.
[root@server bin]# ./rhqctl start --server --agent

Table 2.5. rhqctl Command

Command Description
console Starts a server or storage node in the foreground rather than as a service.
install Installs a server, storage node, or agent instance.
restart Restarts a JBoss ON service. If the type of service is not specified, then all local services are restarted.
start Starts a JBoss ON service. If the type of service is not specified, then all local services are started.
status Shows the status of a JBoss ON service. If the type of service is not specified, then the status of all local services is displayed.
stop Stops a JBoss ON service. If the type of service is not specified, then all local services are stopped.
upgrade Upgrades all JBoss ON services. This can be rerun to migrate historical metric data after a server migration.

Table 2.6. rhqctl Options

Option Description Commands That Allow It
--start Starts all services.
  • upgrade
  • install
--server Runs the given command for the local server. If this is specified, then the command only is run for the server, and the other components are ignored (unless they are explicitly mentioned).
  • console
  • restart
  • start
  • stop
  • status
  • install
--agent Runs the given command for the agent. If this is specified, then the command only is run for the agent, and the other components are ignored (unless they are explicitly mentioned).
  • restart
  • start
  • stop
  • status
  • install
--storage Runs the given command for the storage database node. If this is specified, then the command only is run for the storage database node, and the other components are ignored (unless they are explicitly mentioned).
  • console
  • restart
  • start
  • stop
  • status
  • install
--storage-data-root-dir directory Changes the directory where the storage data are stored. By default, the storage node directory is serverRoot/jon-server-3.3.0.GA/rhq-data/.
  • install
--from-server-dir directory Gives the directory path to the server to be upgraded.
  • upgrade
--from-agent-dir directory Gives the directory path to the agent to be upgraded. The upgrade script assumes that the agent is installed in the same directory as the server, in a subdirectory named rhq-agent/. This option is required if the agent is in a different location.
  • upgrade
--run-data-migrator Migrates the data from an existing JBoss ON SQL database into a new monitoring storage database. The upgrade command creates the monitoring database. If this option is not used, any previous monitoring data are lost.
  • upgrade