-----------------------------------------------------------------------

	"@(#)README 1.0 98/09/21 SMI"

	Copyright (c) 09/21/98, by Sun Microsystems, Inc.
	All rights reserved.

-----------------------------------------------------------------------

			Kstat Example
			==============


-----------------------------------------------------------------------
1. Example overview
-----------------------------------------------------------------------
This example shows how to use the JNI interface for Kernel Statistics
based on the Solaris kstat(3M) interface.
It runs only on machines with Solaris Os.

The current directory contains the following source files:
   * build.java
	- This class automatically generates a M-bean for any kernel information 
	  that can be accessed using the kstat interface. It takes as input a 
	  module name and instance name and generates the associated Java M-bean.	  	

   * KernelStat.java
	- This class contains the JNI interface for Kernel Statistics based on the 
	  Solaris kstat(3K) interface. The native library implementing the native 
	  methods is libstat.so provided under:
	    /opt/SUNWconn/jaw/lib/SunOS/sparc/5.x/lib/libstat.so
	  where x is equal to 6 or 7 depending on whether you are using
	  Solaris 2.6 or Solaris 7.

For information on the Solaris kstat library and the way to use it you can do :
man -s 3K kstat.

  
The following script file:
   * doit
 	- This script takes as input a module name and an instance name.
	  It invokes the "build" program with this input. It invokes then
	  "mogen" for each M-bean generated by the "build" program. It 
	  compiles the generated M-bean and the objects created by mogen.
	  
   
-----------------------------------------------------------------------
2. Building and running the example
-----------------------------------------------------------------------
To build the kstat example, copy the example source files to your 
working directory and type the following commands:

   cd <WORKING_DIR>

   javac -d . build.java KernelStat.java


To run the version of the example you have just built, type the 
following commands:

   # Set the LD_LIBRARY_PATH environment variable to specify
   # the directory of the native library libstat.so:

   # Running the example on Solaris 2.6:
   setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/opt/SUNWconn/jaw/lib/SunOS/sparc/5.6/lib
-or-
   # Running the example on Solaris 7:
   setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/opt/SUNWconn/jaw/lib/SunOS/sparc/5.7/lib

   # Generate m-beans for kernel information that can be accessed
   # using the kstat interface:

   doit <kstat module name> <kstat instance name>

   # For example:

   doit le le0
   doit hme hme0
   doit cpu_info cpu_info0
   doit cpu_info cpu_info1
   doit unix rpc_server

   # Make sure that no agents are already running 
   # and start the Java DMK base agent:

   jaw start

   # Then you can try to instantiate the newly created bean
   # using a web browser or the job tool.
