Contents:
IntroductionThis is a simple example to illustrate the usage of Monitor MBeans .It
uses the String Monitor MBean for monitoring the attribute of a StandardMBean.
__________________________________________________________________________________________________________________________
This example contains a Multi-Protocol Agent (StandardJmxAgent.java) that
has one StandardMBean(SimpleClass) registered with it.
It also registers a StringMonitor to monitor the String attribute(" ServiceName")
of the StandardMBean.
The main file StandardJmxAgent.java has 2 adaptors (HTML/RMI) registered
with the MBeanServer.
__________________________________________________________________________________________________________________________
Source files
The source files are,
To compile the source files go to AdventNet/JavaAgent/examples/jmx/monitor directory in the command prompt and type,
compile *.java [Windows]
sh compile sh *.java [Linux/Solaris]
This will compile the source files in the respective directory.
To start the agent go to AdventNet/JavaAgent/examples/jmx/monitor directory in the command prompt and
1. Run the run.bat or run.sh.
By default
(a) RMI registry service will be started at port 1099
(b) HTML Adaptor will be started at port 8030
2. Use any webbrowser to connect to the Multi-Protocol (JMX) server (through HTML adaptor) by specifying the URL as http://localhost:8030
3. Use MBean browser to access the data through RMI(Start MBean Browser using MBeanBrowser.bat/MBeanBrowser.sh in AdventNet/JavaAgent/bin directory)
1. The agent will be started.
2. Goto the command prompt of the agent and press any key to activate the
monitor.
3. Once the String monitor is started, the value of the attribute is compared
with the StringtoCompare( "Test", in this example).Since it differs , a MonitorNotification
of the type "jmx.monitor.string.differs" is emitted which is seen on the agent
console.
4. Try to set the attribute value to Test using the WebBrowser or the MBeanBrowser.
5. A MonitorNotification of the type "jmx.monitor.string.matches" is emitted
which is seen on the agent console.
__________________________________________________________________________________________________________________________
Copyright (c) 1996-2004 AdventNet, Inc. All Rights Reserved.