Ubuntu系统部署tomcat并启用JMX实战案例

                            作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.安装JDK环境

1>.更换阿里云的软件源

[root@zabbix_gateway250.yinzhengjie.org.cn ~]# vim /etc/apt/sources.list
[root@zabbix_gateway250.yinzhengjie.org.cn ~]#
[root@zabbix_gateway250.yinzhengjie.org.cn ~]# cat /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
[root@zabbix_gateway250.yinzhengjie.org.cn ~]#
[root@zabbix_gateway250.yinzhengjie.org.cn ~]# apt-get update

2>.安装JDK

[root@tomcat250.yinzhengjie.org.cn ~]# apt-get -y install openjdk--jdk

3>.以二进制方式安装JDK

  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie/p/12199413.html

二.配置tomcat支持JMX功能

1>.基于二进制方式部署tomcat

  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie/p/12199468.html

2>.自定义tomcat测试首页

[root@tomcat250.yinzhengjie.org.cn ~]# echo "<h1>Jason Yin bolg is [https://www.cnblogs.com/yinzhengjie/].</h1>" > /yinzhengjie/softwares/tomcat/webapps/ROOT/index.html
[root@tomcat250.yinzhengjie.org.cn ~]#
[root@tomcat250.yinzhengjie.org.cn ~]# /yinzhengjie/softwares/tomcat/bin/catalina.sh start

3>.配置tomcat支持JMX功能(/yinzhengjie/softwares/tomcat/bin/catalina.sh)

#Add by yinzhengjie for enable JMX
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=172.200.5.250" 温馨提示:
  -Dcom.sun.management.jmxremote:
    启用远程监控JMX。
  -Dcom.sun.management.jmxremote.port=:
    默认启动的JMX端口号,要和zabbix添加主机时候的端口一致即可。
  -Dcom.sun.management.jmxremote.authenticate=false :
    不使用用户名密码。
  -Dcom.sun.management.jmxremote.ssl=false:  
    不使用ssl认证。
  -Djava.rmi.server.hostname=172.200.5.250":
    tomcat主机自己的IP地址,不要写zabbix服务器的地址。

4>.重启tomcat并确认tomcat服务

[root@tomcat250.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 127.0.0.53%lo: 0.0.0.0:*
LISTEN 0.0.0.0: 0.0.0.0:*
LISTEN *: *:*
LISTEN [::]: [::]:*
LISTEN [::ffff:127.0.0.1]: *:*
[root@tomcat250.yinzhengjie.org.cn ~]#
[root@tomcat250.yinzhengjie.org.cn ~]#
[root@tomcat250.yinzhengjie.org.cn ~]# /yinzhengjie/softwares/tomcat/bin/catalina.sh stop
Using CATALINA_BASE: /yinzhengjie/softwares/tomcat
Using CATALINA_HOME: /yinzhengjie/softwares/tomcat
Using CATALINA_TMPDIR: /yinzhengjie/softwares/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /yinzhengjie/softwares/tomcat/bin/bootstrap.jar:/yinzhengjie/softwares/tomcat/bin/tomcat-juli.jar
[root@tomcat250.yinzhengjie.org.cn ~]#
[root@tomcat250.yinzhengjie.org.cn ~]#
[root@tomcat250.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 127.0.0.53%lo: 0.0.0.0:*
LISTEN 0.0.0.0: 0.0.0.0:*
LISTEN [::]: [::]:*
[root@tomcat250.yinzhengjie.org.cn ~]#
[root@tomcat250.yinzhengjie.org.cn ~]#

[root@tomcat250.yinzhengjie.org.cn ~]# /yinzhengjie/softwares/tomcat/bin/catalina.sh stop

三.使用JConsole连接tomcat jmx进行测试

1>.window操作系统安装JAVA

  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie2020/p/12206579.html

2>.如下图所示,运行JConsole并配置tomcat的JMX连接地址及端口,并点击"连接"

3>.点击"不安全的连接"

4>.查看你关心的监控数据

 

最新文章

  1. CSS尺寸和字体单位-em、px还是%
  2. VS2012使用中容易出现的小问题(长期更新,错多少记多少)
  3. RichEdit 追加 RTF
  4. -XX:+printGC
  5. 【转】python代码风格-PEP8
  6. Hadoop源代码分析【IO专题】
  7. 第十六周oj刷题——Problem J: 填空题:静态成员---计算学生个数
  8. axure7.0下载安装教程
  9. wamp下安装php的xdebug调试的方法
  10. 老李分享:大数据测试中java和hadoop关系
  11. 优化设计提高sql类数据库的性能
  12. jquery toggle 方法被废除的替代方法
  13. ES6 Module export与import复合使用
  14. freeMark模板引擎
  15. 9.3 翻译系列:数据注解特性之Key【EF 6 Code-First 系列】
  16. Python爬虫:HTTP协议、Requests库
  17. maven 如何引入本地jar包
  18. STL学习笔记--排序算法
  19. Vue项目中如何使用Element-UI以及如何使用sass
  20. (麻省理工免费课程)C语言内存管理和C++面向对象编程

热门文章

  1. 【PAT甲级】1001 A+B Format (20 分)
  2. Hash Table(散列表)
  3. PTA的Python练习题(一)
  4. 【剑指Offer面试编程题】题目1362:左旋转字符串--九度OJ
  5. scala命令行界面:help
  6. 【PAT甲级】1005 Spell It Right (20 分)
  7. Java后端 带File文件及其它参数的Post请求
  8. 远程登陆ubantu服务器 .bashrc文件每次打开终端都需要source的问题
  9. uniGUI之换肤(17)
  10. UIViewContentModel图解+文解