GemStone® GemFire Enterprise®

Java JMX RMIConnector Programming Example

The healthMonitor example is a JMX client application that connects to the GemFire JMX Agent via an RMIConnector to monitor the health of a GemFire Enterprise distributed system. The example is located in the GemFire installation under examples/dist/healthMonitor.

Before running this application, you need to create a terminal session and configure its environment according to the instructions provided under the GemFire installation in examples/EnvSetup.html. Be sure to include the JMX-related environment changes that are specific to this example.

Change to the examples/dist/healthMonitor directory in the terminal session.

Next, start the GemFire JMX Agent by entering the following command:

agent start

Now run the application. The healthMonitor usage is:

java healthMonitor.HealthMonitor <host> <port> [<>]

The host is the name of the system where you started the agent. The port is the agent's RMIConnectorServer port (default 1099). This sample startup line starts the application for an agent launched on a host named "lucy" on the default RMIConnectorServer port:

java healthMonitor.HealthMonitor lucy 1099

You may optionally specify a file as an argument to HealthMonitor. It will also automatically pick up any file that you place in the examples/dist/healthMonitor directory. The application will then use the values in the properties file to determine details on the system it will connect to:

java healthMonitor.HealthMonitor lucy 1099

Once started, the application will attach to the GemFire JMX Agent using the RMIConnector as defined by JSR 160. By configuring the Agent and manipulating the MBeans that it exposes, the application will monitor the health of a GemFire distributed system and its members.

To stop the agent and locator, follow these steps:

  1. In the terminal session, press CTRL-C to display the command prompt.
  2. Enter agent stop to shut down the JMX agent.
  3. Enter exit to close the terminal session.