psi-probe监控tomcat性能指标
psi-probe是在相同的开源许可证(GPLV2)下分发的社区驱动的LAMBDA Probe。它的目的是替换和扩展Tomcat管理器,使得管理和监视Apache Tomcat的实例更容易。psi-prob不需要对现有应用程序进行任何更改。它通过一个Web可访问的接口提供它的所有特性,只需将它部署到服务器即可。
一、安装
1、war包安装
到github下载war包,将该war包放到 tomcat的应用发布目录下,如常用的webapps目录下。
2、catalina文件修改
1修改conf/catalina.bat(for win)
2set JAVA_OPTS=-Dcom.sun.management.jmxremote
3或修改conf/catalina.sh(for linux)
4export JAVA_OPTS=$JAVA_OPTS" -Dcom.sun.management.jmxremote"
也可以直接设置环境变量。
3、配置认证用户
修改$CATALINA_HOME/conf/tomcat-users.xml文件,增加类似如下内容:
1<role rolename="manager">
2<role rolename="poweruser">
3<role rolename="tomcat">
4<role rolename="poweruserplus">
5<role rolename="probeuser">
6<user username="tomcat" password="tomcat" roles="manager,poweruser,probeuser,poweruserplus"></user></role></role></role></role></role>
tomcat-users.xm包含了所有Tomcat服务器的注册用户,其中有role(角色)、user(用户)两种信息。
role:Tomcat中保存了一些用户权限,也就是角色,比如admin、Tomcat等。用户还可以自定义,通过””来注册一个角色。它只有rolename一个属性,通过这个属性可以把用户的权限进行分配。
User:这个数据项中包含了诸如用户名、用户密码、用户权限、用户说明等数据属性。probe有 probeuser、poweruser、poweruserplus、manager(针对不同tomcat版本)等角色,对应可操作的功能如下表(表格里面的X表示拥有权限):
probeuser | poweruser | poweruserplus | manager | |
---|---|---|---|---|
Context: list | X | X | X | X |
Context: status | X | X | X | X |
Context: view servlets | X | X | X | X |
Context: view servlet mappings | X | X | X | X |
Context: view filters | X | X | X | X |
Context: view filter mappings | X | X | X | X |
Context: list attributes | X | X | X | X |
Context: remove attributes | X | X | X | |
Context: start | X | X | X | |
Context: stop | X | X | X | |
Context: view web.xml | X | X | X | |
Context: view context.xml | X | |||
Context: deploy | X | |||
Context: undeploy | X | |||
Session: list | X | X | X | X |
Session: list attributes | X | X | X | X |
Session: search attributes | X | X | X | X |
Session: remove attributes | X | X | X | |
Session: view last-accessed IP | X | X | X | X |
Session: expire single | X | X | X | |
Session: expire multiple | X | X | X | |
JSP: list | X | X | X | |
JSP: view source | X | X | X | |
JSP: view servlet source | X | X | X | |
JSP: compile single | X | X | X | |
JSP: compile multiple | X | X | X | |
JSP: compile all on deployment | X | |||
JSP: discard all compiled | X | |||
Data Source: list | X | X | X | X |
Data Source: group by JDBC URL | X | X | X | X |
Data Source: status | X | X | X | X |
Data Source: reset | X | X | X | |
Data Source: test | X | X | ||
Data Source: view query history | X | X | ||
Data Source: execute SQL | X | X | ||
Log: list | X | X | X | X |
Log: tail in real-time | X | X | X | X |
Log: download | X | X | X | X |
Thread: list | X | X | X | X |
Thread: view execution stack | X | X | X | |
Thread: kill | X | |||
Connector: status | X | X | X | X |
Connector: real-time usage charts | X | X | X | X |
Cluster: status | X | X | X | X |
Cluster: real-time traffic charts | X | X | X | X |
JVM: real-time memory usage charts | X | X | X | X |
JVM: status | X | X | X | X |
JVM: advise GC | X | |||
Java Service Wrapper: status | X | X | X | X |
Java Service Wrapper: restart JVM | X | |||
System: overview | X | X | X | X |
System: properties | X | X | X | X |
System: OS details | X | |||
Quick Check: execute | X |
以上配置完成后,重启tomcat。
二、使用
访问http://localhost:8080/probe/ ,输入上面user里配置的用户名密码登陆。根据当初赋予的权限的不同,其具有war应用部署、tomcat日志查看、线程查看和停止、系统资源信息查看、连接信息查看等功能。这里截取了下资源情况的图片,如下:
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))
- Author: shisekong
- Link: https://blog.361way.com/tomcat-probe/6083.html
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.