当前位置: 首页 > article >正文

Tomcat监控与调优:比Tomcat Manager更加强大的Psi-Probe

这是一款 Tomcat 管理和监控工具,前身是 Lambda Probe。由于 Lambda Probe 2006不再更新,所以 PSI Probe 算是对其的一个 Fork 版本并一直更新至今。

Probe

psi-probe是在相同的开源许可证(GPLV2)下分发的社区驱动的 Lambda Probe ,psi-probe的前身是 Lambda Probe,由于Lambda Probe 2006之后不再更新,所以psi-probe算是对其的一个 Fork版本并一直更新至今。它的目的是替换和扩展 Tomcat 管理器,使得管理和监视 Apache Tomcat 的实例更容易。与许多其他服务器监控工具不同,psi-probe不需要对现有应用程序进行任何更改。它通过一个Web可访问的接口提供它的所有特性,只需将它部署到服务器即可。

使用psi-probe监控的步骤如下:

安装probe

目前我们一般都是安装psi-probe的版本,将下载的安装包解压缩,放进webapps目录。

通过网盘分享的文件:probe.war 链接:
https://pan.baidu.com/s/1ZpMyjH6D-tj2gBLRJIe-dQ?pwd=4hc2 提取码: 4hc2

配置用户与角色

使用probe监控工具时,会提醒输入登录的用户信息,该登录的用户信息角色必须为manage-gui。在tomcat-users.xml文件中配置即可。具体的代码如下:

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
  <role rolename="tomcat" />
  <role rolename="manager" />
  <role rolename="admin-gui" />
  <role rolename="manager-gui" />
  

  <user username="yongjie" password="abc123" roles="tomcat,manager,admin-gui,manager-gui,probeuser,poweruserplus,poweruser" />
  

</tomcat-users>

配置conf/catalina.bat或catalina.sh文件。

export JAVA_OPTS=$JAVA_OPTS" -Dcom.sun.management.jmxremote" 

重启Tomcat服务器

tomcat停止
 /bin/shutdown.sh
tomcat启动
 /bin/startup.sh

进入监控界面

http://ip:port/probe

例如
http://192.168.40.133:8080/probe/

监控界面的信息如图所示。
在这里插入图片描述

Requests:在单个应用程序的基础上, 实时监控流量。
Sessions:浏览/搜索属性,查看最后的IP,过期,估计大小。
jsp:浏览,查看源代码,编译。
Data Sources:查看池使用情况,执行查询。
Logs:查看内容,下载,在运行时更改级别。
Threads:查看执行堆栈,杀死。
Connectors:状态,使用图表。
Certificates:系统信任存储和连接器密钥存储/信任存储
Cluster:状态,使用图表。
JVM:内存使用图表,建议GC
Java Service Wrapper:重启JVM。
System:CPU使用,内存使用,交换文件使用。

除上面那功能,部分个人觉得实用功能如下:

管理端支持国际化
可在线查看或下载Log日志
可监控内存每个区域的使用情况
在线查看Tomcat配置信息,jdk信息、操作系统信息等
在线发布项目
支持集群监控、线程监控
在线查看servlet、过滤器、web.xml、content.xml、jsp等具体配置

为什么不使用jdk自带的工具(jstack、jmap…)进行监控?

jdk自带的监控工具基本都需要进入服务器内部,通过命令去查看分析,没有可视化界面更加直观,还有就是这些工具功能比较单一,命令比较多,难记住,主要这些工具主要是监控JVM相关的信息,对于web容器中请求、session、并发数都没有监控到。

可以通过工具-在本地通过jdk自带的jvisualvm和jconsole远程监控Tomcat的JVM运行这种方式来监控唉,这种方式虽然有可视化界面了,但还是存在监控到的信息有限,并且通过跨服务器jmx远程监控这种方式还受限于网络影响。

其他监控工具:

Javamelody,该工具高度与应用系统耦合,需要应用依赖于对应的jar包和web.xml filter的配置,需要和其他框架进行整合才能使用。


http://www.kler.cn/news/335614.html

相关文章:

  • AI学习记录 - L2正则化详细解释(权重衰减)
  • MySQL基础之函数
  • 【PCL】Ubuntu22.04 安装 PCL 库
  • 时序逻辑-延一拍/打一拍?
  • Chrome无法拖入加载.crx扩展文件(以IDM为例)
  • 【力扣 | SQL题 | 每日四题】力扣613, 579, 578, 580, 585
  • C# 表达式与运算符
  • (十八)、登陆 k8s 的 kubernetes-dashboard 更多可视化工具
  • 关于CSS 案例_新闻内容展示
  • Ubuntu 22.04.4 LTS更换下载源
  • 红黑树学习
  • 自然语言处理问答系统
  • windows下安装cmake+opencv(QT+MinGW版本)
  • 嵌入式硬件设计中EDA布局与布线实现
  • 微服务Sleuth解析部署使用全流程
  • OpenAI预计明年将推出“代理”系统
  • 一张图片生成数字人的3D发型:技术创新与应用前景
  • 【Python】Marmir 使用指南:Python 驱动的电子表格生成器
  • 佑航科技Pre-A+轮融资成功:加速车载超声波芯片研发与量产
  • 因浏览器未发送Referer HTTP头导致Django项目CSRF验证失败的原因