JavaMelody open-source system performance monitoring

Source: Internet
Author: User

JavaMelody open-source system performance monitoring
1. download the required jar package

JavaMelody requires two jar packages: j2.16.jarand javamelody.jar. go to the official website to download javamelody-1.36.0.zip, which contains the two jar packages.

2. Build the environment

(1) Place jrobin. jar and javamelody. jar under the WEB-INF/lib of the Local WEB project so that it can be accessed under ClassPath.

(2) Open the WEB. xml file of the web project and add the following Configuration:

[Html]
<Filter>
<Filter-name> monitoring </filter-name>
<Filter-class> net. bull. javamelody. MonitoringFilter </filter-class>
</Filter>
<Filter-mapping>
<Filter-name> monitoring </filter-name>
<Url-pattern>/* </url-pattern>
</Filter-mapping>
<Listener>
<Listener-class> net. bull. javamelody. SessionListener </listener-class>
</Listener>

[Html]
<Filter>
<Filter-name> monitoring </filter-name>
<Filter-class> net. bull. javamelody. MonitoringFilter </filter-class>
</Filter>
<Filter-mapping>
<Filter-name> monitoring </filter-name>
<Url-pattern>/* </url-pattern>
</Filter-mapping>
<Listener>
<Listener-class> net. bull. javamelody. SessionListener </listener-class>
</Listener>

(3) Deploy the WEB Project to the J2EE container, start the container, and access the program running status through the URL below.

 

 

<Host>: host Name

<Port>: port address

<Context>: configure the address for your application.

 

You can see the memory usage, the number of sessions, the number of threads, and so on. It can also be displayed on a daily, weekly, monthly, or yearly chart, which is quite convenient and practical.

 

(4) I found that JDBC and SQL are not monitored from the interface just now, because my data source is configured in spring bean.

Add the javamelody spring configuration to the place where the spring configuration file is loaded in web. xml. It can wrap spring objects as proxies. You just need to add classpath: net/bull/javamelody/monitoring-spring.xml In the first line of the configuration. The details are as follows:

[Html]
<Context-param>
<Param-name> contextConfigLocation </param-name>
<Param-value>
Classpath: net/bull/javamelody/monitoring-spring.xml
Classpath: context/services. xml
Classpath: context/data-access-layer.xml
/WEB-INF/applicationContext. xml
</Param-value>
</Context-param>

[Html] www.2cto.com
<Context-param>
<Param-name> contextConfigLocation </param-name>
<Param-value>
Classpath: net/bull/javamelody/monitoring-spring.xml
Classpath: context/services. xml
Classpath: context/data-access-layer.xml
/WEB-INF/applicationContext. xml
</Param-value>
</Context-param>

(5) restart the J2EE container to view the number of JDBC connections and SQL Execution.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.