Management and Monitoring Example

Management and Monitoring Example

This example uses an MBean server to manage and monitor a node in a distributed system. One node acts as an MBean server that gets information from other nodes.

Running the Example

Note: To run this example, you must have terminal sessions configured for the QuickStart examples, as described in Setting Up Your Environment for Running the Examples.
  1. Change to the <Install_Directory>/SampleCode/quickstart directory.
  2. Open one terminal session, and run the following command to start the managed node:
    java -cp "$GEMFIRE/SampleCode/quickstart/classes:$GEMFIRE/lib/server-dependencies.jar" quickstart.ManagedNode

    The managed node retrieves an MBean locally from the management service, creates a local cache and the exampleRegion region, adds information retrieved from the MBean such as entry count to the region, and displays information about the items. Wait for the following message before continuing:

    Start Manager Node and wait till it completes
  3. Open a second terminal session and run the following command:
    java -cp "$GEMFIRE/SampleCode/quickstart/classes:$GEMFIRE/lib/server-dependencies.jar" quickstart.ManagerNode
    The manager node creates a region and retrieves the region MBean from the managed node you started in the first session. Wait for the following message before continuing:
    Press enter in Managed Node
  4. In the first session, press ENTER.

Example Source Files

Table 1. Cache configuration files, located in SampleCode/quickstart/xml
managed-node.xml Creates a cache and region for MBean data.

Table 2. Java program files, located in SampleCode/quickstart/quickstart Retrieves the region MBean for all members of a GemFire distributed system. Retrieves a local region MBean.

Related Javadocs

  • com.gemstone.gemfire.cache.CacheFactory