Java Web 服务器性能监控工具 JavaMelody

1、maven 依赖

<dependency>
    <groupId>net.bull.javamelody</groupId>
    <artifactId>javamelody-core</artifactId>
    <version>1.58.0</version>
</dependency>
<dependency>
    <groupId>org.jrobin</groupId>
    <artifactId>jrobin</artifactId>
    <version>1.5.9</version>
</dependency>

jetty 服务器插件

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                <port>8888</port>
            </connector>
        </connectors>
        <contextPath>/</contextPath>
    </configuration>
</plugin>

2、web.xml 里面配置过滤器和监听器

<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、在浏览栏里输入 http://127.0.0.1:8888/monitoring
大功告成!

参考资料:
java web服务器性能监控工具JavaMelody - 梦寻千古的专栏 - 博客频道 - CSDN.NET
http://blog.csdn.net/greecezeus/article/details/16843691

你可能感兴趣的:(Java Web 服务器性能监控工具 JavaMelody)