码迷,mamicode.com
首页 > 其他好文 > 详细

修改jmx远程监控wildfly/jboss配置,然后通过jdk自带的visualvm工具来进行性能监控

时间:2018-05-29 22:53:00      阅读:516      评论:0      收藏:0      [点我收藏+]

标签:http   java   添加   修改   inf   9.png   rem   切换   信息   

近新搭建了系统环境,进行压力测试的时候没有一个好的图形化监控方法来比较直观、方便、动态、实时的来监控应用服务器内存、GC、CPU、进程和磁盘等信息,功能非常强大,图像也很友好。但是wildfy配置jmx的文章资料很少,我通过参考官网和一些贴吧实践琢磨出了配置jmx的流程:

1】确认监控端口(一般都是8080端口)

standalone:查看standalone.xml中jboss.http.port为8080

domain:查看standalone.xml中jboss.http.port为8080

# netstat -anlp | grep 8080
tcp 0 0 192.168.101.11:8080 0.0.0.0:* LISTEN 21558/java

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

2】通过wildfly的module.xml文件中添加jboss远程监控模块,并启用该模块

standalone:
vim /opt/wildfly/modules/system/layers/base/org/wildfly/extension/io/main/module.xml
domain:
vim /opt/jboss/modules/system/layers/base/org/wildfly/extension/io/main/module.xml

添加,并启用:

<module name="org.jboss.remoting" export="true"/>
<module name="org.jboss.remoting-jmx" export="true"/>

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

3】jboss添加用户jbsuser,并添加权限

standalone:
/opt/wildfly/bin/add-user.sh -a -u jbsuser -p jbsuser
/opt/wildfly/bin/jboss-cli.sh --connect --commands="/core-service=management/access=authorization/role-mapping=Administrator:add"
/opt/wildfly/bin/jboss-cli.sh --connect --commands="/core-service=management/access=authorization/role-mapping=Administrator/include=jbsuser:add(name=jbsuser,type=USER)"

domain:
/opt/jboss/bin/add-user.sh -a -u jbsuser -p jbsuser
/opt/jboss/bin/jboss-cli.sh --connect --commands="/core-service=management/access=authorization/role-mapping=Administrator:add"
/opt/jboss/bin/jboss-cli.sh --connect --commands="/core-service=management/access=authorization/role-mapping=Administrator/include=jbsuser:add(name=jbsuser,type=USER)"

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

4】关闭wildfly,通过切换到jbsuser用户(避免误杀),执行pkill -9 java

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

5】启动wildfly,现在就配置好jmx的远程配置了

standalone:
/opt/wildfly/bin/start.sh
domain:
/opt/jboss/bin/start.sh

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

6】VisualVM客户端连接:

1、添加远程主机

技术分享图片

2、右击,需要点击【添加JMX连接】按钮

技术分享图片

3、

service:jmx:http-remoting-jmx://192.xx1.6:8080
输入用户:jbsuser
输入密码:jbsuser

技术分享图片

7】激动人心的时刻到了,大家可以点击jmx来监控服务器的资源了,看看成果吧

技术分享图片

 

standalonestandalone.xmljboss.http.port

domaindomain.xml 搜索:jboss.http.port 

修改jmx远程监控wildfly/jboss配置,然后通过jdk自带的visualvm工具来进行性能监控

标签:http   java   添加   修改   inf   9.png   rem   切换   信息   

原文地址:https://www.cnblogs.com/tangculijizyw/p/9108015.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!