Mercurial > hg > blitz_condensed
view docs/stats_example.html @ 34:6f68e94c1fb8 default tip
Add CondensedStats monitoring utility, equivalent to vmstat
author | Dominic Cleal <dominic-cleal@cdo2.com> |
---|---|
date | Thu, 05 Aug 2010 11:07:25 +0100 |
parents | 3dc0c5604566 |
children |
line wrap: on
line source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Blitz Stats Example</title> </head> <body> <h1>Blitz Stats Example</h1> <h2>Introduction</h2> This example provides a simple demonstration of how to use the <code>org.dancres.blitz.stats</code> package. <h2>Compiling</h2> The example consists of two classes: <ol> <li><a href="../examples/statsclient/stats/Lookup.java">Lookup</a> which handles service lookup.</li> <li><a href="../examples/statsclient/stats/TestClient.java">TestClient</a> which actually manipulates the stats interfaces.</li> </ol> In order to compile these classes you will require the following <code>.jar</code>'s: <ul> <li><code>jsk-platform.jar, jsk-lib.jar</code> from the JINI 2.x distribution.</li> <li><code>stats.jar</code> from the Blitz distribution. This <code>.jar</code> contains classes which <em>must</em> be available to the client when it is run (they cannot be downloaded). Note that the proxy code in <code>blitz-dl.jar</code> will be downloaded as usual.</li> </ul> Assuming that your JINI 2.x distribution is in <code>/jini2_1</code> and your Blitz distribution is in <code>/blitz</code>, you can compile the example as follows: <pre> cd /blitz/examples/statsclient javac -classpath /jini2_1/lib/jsk-lib.jar:/jini/jini2_1/lib/jsk-platform.jar:/blitz/lib/stats.jar *.java </pre> <h2>Running</h2> <p>Before starting the example, ensure that you have a Blitz instance running in a public lookup group - see the <a href="install_guide.html">Installation Guide</a>. This is necessary because the <code>Lookup</code> class does a single lookup and discover step - it does not register with discovered lookup services. Thus, if a Blitz instance isn't registered beforehand, it will not be found (I'll fix this in a future release!).</p> Having compiled the example, you can run it as follows (with the same assumptions about installation locations as above): <pre> cd /blitz java -Djava.security.policy=config/policy.all -classpath /jini2_1/lib/jsk-lib.jar:/jini2_1/lib/jsk-platform.jar:/blitz/examples/statsclient:/blitz/lib/stats.jar stats.TestClient </pre> <h2>Configuring Defaults</h2> In addition to passing an array of Switch objects to Blitz via the StatsAdmin interface, it's possible to configure default settings via the config file using an entry like: <pre> // Default Stats to make available stats = new Switch[] {new OpSwitch(OpSwitch.ALL_TYPES, OpSwitch.TAKE_OPS, true), new OpSwitch(OpSwitch.ALL_TYPES, OpSwitch.READ_OPS, true), new OpSwitch(OpSwitch.ALL_TYPES, OpSwitch.WRITE_OPS, true)}; </pre> <p><div align="center"><a href="../index.html">Back to Documentation</a></div></p> </body> </html>