当前位置 主页 > 本站WEB程序 > 安全 > IIS7网站监控 >
最简单的目的:
监控每个api的请求时间和点击次数;
监控每个service的执行时间;
监控每个SQL的执行时间;
通过问题排查原因,这个框架算是比较简单的实现了。
效果如下:
集成步骤:
添加依赖:
<!-- https://mvnrepository.com/artifact/net.bull.javamelody/javamelody-core -->
<dependency>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<version>1.79.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jrobin/jrobin -->
<dependency>
<groupId>org.jrobin</groupId>
<artifactId>jrobin</artifactId>
<version>1.5.9</version>
</dependency>
配置web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<!--<param-value>classpath*:spring-mybatis.xml</param-value>-->
<param-value>
classpath*:spring-*.xml
classpath*:net/bull/javamelody/monitoring-spring.xml
</param-value>
</context-param>
<!--java melody start-->
<listener>
<listener-class>net.bull.javamelody.SessionListener
</listener-class>
</listener>
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ASYNC</dispatcher>
</filter-mapping>
<!--java melody end-->
好了,运行你的项目吧
访问地址:http://127.0.0.1:8080/monitoring