一,jconsole的监控本地tomcat
1,打开tomcat下的bin路径,编辑catalina.bat
2,在第一行加入,保存,然后启动tomcat,cmd窗口执行startup.bat
set "JAVA_OPTS=-server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:+DisableExplicitGC -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8080 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
3,打开jconsole.exe,在jdk的bin目录,选择本地进程,点击连接
二,springboot的actuator监控中心,(缺点没有界面UI)
添加依赖
<dependency>
groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
server:
port: 8081
management:
security:
enabled: false #关掉安全认证
port: 8088 #管理端口调整成8088
context-path: /monitor #actuator的访问路径http://localhost:8088/monitor/beans
#springboot2.0之后需要加actuator去访问
endpoints:
shutdown:
enabled: true
#自定义用户信息
info:
app:
name: spring-boot-actuator
version: 1.0.0
下面是各个路径的作用
路径 | 作用 |
/actuator/beans | 显示应用程序中所有Spring bean的完整列表。 |
/actuator/configprops | 显示所有配置信息。 |
/actuator/env | 陈列所有的环境变量。 |
/actuator/mappings | 显示所有@RequestMapping的url整理列表。 |
/actuator/health | 显示应用程序运行状况信息 up表示成功 down失败 |
/actuator/info | 查看自定义应用信息 |
案例一:”查看接口是否正常:返回up表示正常,down不正常
http://localhost:8088/monitor/health
案例二:查看自定义应用信息
三,Admin-UI分布式微服务监控中心(相比于actuator监控有了界面ui)