JAMon : Monitor web application resources

JAMon (Java Application Monitor) is a Java API used to monitor the performance and the scalability of Java applications.

In this tutorial, we will use JAMon to track pages hits and execution times of a JSF application.

 

1. Technologies used

  • JAMon 2.74
  • JSF 2.2.8
  • Tomcat 7.0

 

2. Project structure

We start by creating a simple web application.

JAMon-Web-Application-Resources-1

 

3. Managed Bean

We add a managed bean to implement the business logic.

 

4. Pages to monitor

We add some pages that we’ll monitor by JAMon.

Page 1 : index.xhtml

 

Page 2 : welcome.xhtml

 

Page 3 : somepage.xhtml

 

Page 4 : otherpage.xhtml

 

5. JAMon libraries

To use JAMon, we must add the following libraries in Tomcat lib (../Tomcat 7.0/lib/).

JAMon-Web-Application-Resources-2

 

6. Configure JAMonFilter

It is a Servlet Filter we’ll  declare in web.xml file to monitor our JSF pages.

File : web.xml

We told to JAMon to monitor all resources ending with .xhtml.

 

7. Install jamon.war

It is a web application provided by JAMon to view and query collected statistics.

JAMon-Web-Application-Resources-3

We need to install jamon.war into Tomcat (by simply putting the war file in ../Tomcat 7.0/webapps/ folder)

 

8. Test It

We, first, install our application into the Tomcat server.

Then, we’ll access the application pages to let JAMon gather statistics.

JAMon-Web-Application-Resources-4

Finally, we can view the statistics by running : http://localhost:8080/jamon/jamonadmin.jsp

JAMon-Web-Application-Resources-5

 

Download source code

 

Reference