以下是监控Linux上Tomcat运行状态的常用方法:
系统命令监控
ps -ef | grep tomcat 或 jps -l 查看Tomcat进程是否运行。netstat -tulnp | grep 8080 或 ss -tulnp | grep 8080 检查默认端口(可自定义)是否监听。systemctl status tomcat(systemd系统)或 service tomcat status(SysVinit系统)。日志分析
tail -f /path/to/tomcat/logs/catalina.out 监控运行日志。JMX远程监控
conf/server.xml中添加JMX配置参数(如rmiRegistryPortPlatform和rmiServerPortPlatform)。第三方工具监控
http://localhost:8080/manager(需配置用户权限),查看应用状态、会话数等。资源监控
top -p $(pgrep -f tomcat) 或 htop 查看进程资源占用。netstat -anp | grep 8080 统计当前连接数。注:生产环境建议结合JMX和第三方工具(如Prometheus+Grafana)实现全面监控,并配置告警机制。