How to Monitor Alfresco with JavaMelody
I've recently wrote a post on how to monitor Alfresco using a very robust open-source stack of tools. This is still the more complete and robust way to have an integrated monitoring system covering all your Alfresco infrastructure.
For those who just want to monitor the relevant aspects of your Alfresco application and want to do a quick setup of a monitoring system, JavaMelody is a good solution. If you are troubleshooting a problem and you want to know what is happening with the machine resources (Threads, Memory, Slow JDBC queries, etc) JavaMelody is your friend. It takes no more than 10 minutes to setup.
JavaMelody it’s a simple tool used to monitor Java or Java EE application servers in QA and production environments. It’s a tool to measure and calculate statistics of real operations of an application depending on the usage of the application by users. JavaMelody it’s easy to integrate in most applications.
The tool is mainly based on statistics of requests and evolution charts, allowing us to see in real time the evolution charts of the most important aspects of our Alfresco.
It includes summary charts showing the evolution over time of the following indicators:
- Number of executions, mean execution times and percentage of errors of http requests, sql requests, jsp pages or methods of business façades (if EJB3, Spring or Guice)
- Java memory, Java CPU , User sessions, Jdbc connections ,Tomcat threads
- An much much more.
These charts can be viewed on the current day, week, month, year or custom period.
The Architecture of JavaMelody is lightweight. So it has a lower overhead as I can compare it to other available solutions. The overhead is so low that it can be enabled continuously in QA and Production environments. A really nice thing is the storage of historical data - you can have a look at the same graphs spanning a week, a month or a year without setting up any additional infrastructure.
JavaMelody helps you to
- Identify problems before they become too serious
- Optimize based on the more limiting response times
- Find the root causes of response times
- Verify the real improvement after optimization
- Check out the different types of memory being used (Heap, PermGen, Cache etc.)
- Give facts about the average response times and number of executions
- Provide data to help improve applications in QA and production
Detailed documentation can be found at https://github.com/javamelody/javamelody/wiki/UserGuide
First step should be to download the latest JavaMelody distribution jar from https://github.com/javamelody/javamelody/releases/download/javamelody-core-1.57.0/javamelody-1.57.0.jar and copy it to the alfresco/WEB-INF/lib lib directory.
You also need to include some dependencies to have the full features enabled (Pdf export)
To enable the JavaMelody integration you need to update the alfresco deployment descriptor. You can include this update as part of the Tieto build project.
Edit the web.xm file and add the spring javamelody filter
Update spring contextConfigLocation
<!-- Spring Application Context location monitoring-spring-datasource.xml monitoring-spring.xml -->
<description>Spring config file location</description>
Note that The SQL time measured is the time from invoking the statement from JDBC until there is a resultset. It does not include the time to fetch the data for a select, nor does it include the time for jdbc ResultSet.next().
If you want BASIC authentication with username and password, but do no want to use a realm and 'security-constraint' in web.xml, you can add the parameter 'authorized-users' in web.xml, in context or in system properties like the other javamelody parameters (since v1.53). For example in your WEB-INF/web.xml file:
Now that you've done all the necessary steps, restart your tomcat (or other application server) and go to:
'Voilá' , you have your monitoring server up and running.
You can disable JavaMelody using disabled=false using the init parameter in web.xml
pass -Djavamelody.disabled=true as system property
You can avoid all the configuration mentioned above if you use the Maven Integration feature on your project build. The dependencies are the following :
<!-- Minimal dependencies for JavaMelody -->
You can integrate JavaMelody on every web-app, following the example below.
<!-- restrict access using HTTP basic authentication -->
<!-- set a different URL for monitoring -->
<!-- enable/disable JavaMelody -->
<!-- define an storage path for JavaMelodys historical data -->
I hope you enjoy Javamelody and that you find this post useful. Please post some comments and feedback, those help me to know that actualy anyone is reading my posts :). Seriously, i appreciate your feedback.
Keep sharing, support the Alfresco Community as the Community supports you.
To join our community click https://www.alfresco.com/community
One Love, Luis