JAMon (Java Application Monitor)

A Java Monitoring API

JAMon Introduction

The Java Application Monitor (JAMon) is a free, simple, high performance, thread safe, Java API that allows developers to easily monitor production applications.

In addition to using modules developers can monitor anything the modules don't cover by using JAMon's simple API methods 'start/stop' and 'add'.

Of course nobody wants to litter their code with calls to add and stop, so when possible JAMon monitoring modules should be used as they allow the easiest monitoring. JAMon was developed primarily for monitoring web applications, however JAMon can be used in any JDK 1.6 or higher environment.

Feel free to continue reading the user's guide or download JAMon and read the Java Docs. The following is a screen snapshot of jamonadmin.jsp from the JAMon WAR. It gives an idea of the type of information JAMon collects such as metrics on: SQL, JDBC, http page requests, http status codes, garbage collections, and exceptions.

Monitoring your application

JAMon comes with several ways to monitor your application that require no application code changes. Usually all that is required is to...

See HTTP Monitoring for directions on how to monitor page requests in your web server. See JAMon Modules for other easy ways to monitor different aspects of your application. You could be monitoring your code in a few minutes. Happy monitoring!

Maven

JAMon is on Maven. The Maven pom dependency follows (substitute the appropriate version):
    <dependencies>
        <dependency>
            <groupId>com.jamonapi</groupId>
            <artifactId>jamon</artifactId>
            <version>2.81</version>
        </dependency>
    </dependencies>
    

Quick Links

JAMon Modules - The following links show how to enable monitoring with JAMon's preconfigured modules:

Features - The following contain links to useful JAMon features:

Videos - Short YouTube tutorials showing how to use JAMon

API - start/stop methods

MonitorFactory.start("myLabel"); - The start/stop methods time any code that they surround.

import com.jamonapi.*;
...
Monitor mon=MonitorFactory.start("myFirstMonitorLabel"); // using Strings is flexible as they can represent anything.
...Code Being Timed...
mon.stop();
"myFirstMonitorLabel" can be replaced by strings that represent...
  • Page names - "/mydirectory/myfantasticpage.jsp"
  • SQL statements - "select * from myawesometable"
  • or anything else you would like to time.

JAMon keeps the label and units as a key in a Map and every time start or add are called with the same key JAMon updates statistics for: hits, total, average, min, max and concurrency (average, max, current/active) to name a few.

API - add method

MonitorFactory.add("myLabel", "myUnits", myValue); - Sometimes developers are interested in counting the frequency of items (such as exceptions, or page requests with a certain status code). In addition they are interested in measuring other concepts such as how many bytes are sent/received, or how much free memory there is. JAMon provides the 'add' method to handle these situations.

import com.jamonapi.*;
...
double myValue=...
MonitorFactory.add("myBytesSentLabel", "MB", myValue); // units can be any string, and myValue can be any numeric

JAMon keeps the label and units as a key in a Map and every time start or add are called with the same key JAMon updates statistics for: hits, total, average, min, max and concurrency (average, max, current/active) to name a few.

Link to another simple example.

API - Capturing details/context

MonitorFactory.add(new MonKeyImp(label, details, units), myValue); - An alternative way of calling JAMon start/stop or add methods is to pass in an explicit key. The advantage of passing in the key (MonKey) is that you can also pass in 'details'. 'details' can can be any context information that is useful information fo the developer. For example a stacktrace, method arguments, or http parameters could be passed in.

JAMon typically deals with aggregate data, however the power of JAMonListeners. all data passed in as a 'detail' can later be viewed via the JAMon web application. To get more information about this capability see JAMonListener example.

import com.jamonapi.*;
...
double myValue=...
String stackTrace=...

MonKey key=new MonKeyImp("com.jamonapi.pageHits", stackTrace, "ms.");
Monitor mon=MonitorFactory.add(key, myValue);

JAMon License Agreement

JAMon has a very liberal license. The spirit of the license is that there are no restrictions on its use. Should something not be clear in the license please to contact admin@jamonapi.com. In general JAMon binaries can be used free of charge in any software (commercial software too), and JAMon source code may be modified. The JAMon License was adapted from the BSD license.

SourceForge.net Logo