云计算 python JVM 内存监控

云计算 python JVM 内存监控,第1张

云计算 python JVM 内存监控

安装tomcat

 

 

 

 

 

 

 vim /usr/local/tomcat/conf/server.xml

[root@localhost ~]# mkdir /one

[root@localhost ~]# mkdir /one/ROOT

[root@localhost ~]# cd /one/ROOT/

[root@localhost ROOT]# echo aaaaaaa > index.jsp

[root@localhost ROOT]# /usr/local/tomcat/bin/shutdown.sh

[root@localhost ROOT]# /usr/local/tomcat/bin/startup.sh

[root@localhost ROOT]# vim /etc/hosts

192.168.2.10 www.wjl.com

[root@localhost ROOT]# firefox www.wjl.com:8080

 

 

[root@localhost ROOT]# mkdir /one/aa

[root@localhost ROOT]# echo 11111 > /one/aa/index.jsp

[root@localhost ROOT]# /usr/local/tomcat/bin/shutdown.sh

[root@localhost ROOT]# /usr/local/tomcat/bin/startup.sh

[root@localhost ROOT]# netstat -anput | grep 8080

tcp6       0      0 :::8080                 :::*                    LISTEN      63475/java     

[root@localhost ROOT]# curl www.wjl.com:8080/aa/index.jsp

11111

[root@localhost ROOT]# curl www.wjl.com:8080/aa/

11111

[root@localhost ROOT]# vim /usr/local/tomcat/conf/web.xml

4696         a.jsp

[root@localhost ROOT]# cd /one/aa/

[root@localhost aa]# ls

index.jsp

[root@localhost aa]# echo aaaaaaa > a.jsp

[root@localhost aa]# ls

a.jsp  index.jsp

[root@localhost aa]# /usr/local/tomcat/bin/shutdown.sh

[root@localhost aa]# curl www.wjl.com:8080/aa/

aaaaaaa

[root@localhost aa]# cd /one/aa

[root@localhost aa]# ls

a.jsp  index.jsp

[root@localhost aa]# mv index.jsp index1.jsp

[root@localhost aa]# touch index{2..10}.jsp

[root@localhost aa]# ls

a.jsp        index2.jsp  index5.jsp  index8.jsp

index10.jsp  index3.jsp  index6.jsp  index9.jsp

index1.jsp   index4.jsp  index7.jsp

[root@localhost aa]# vim /usr/local/tomcat/conf/web.xml

111             listings

 112             true

[root@localhost aa]# /usr/local/tomcat/bin/shutdown.sh

[root@localhost aa]# /usr/local/tomcat/bin/startup.sh

[root@localhost aa]# firefox www.wjl.com:8080/aa/

[root@localhost ~]# jconsole

 

Jvm的内存监控

[root@localhost aa]# vim meminfo.jsp

<%

Runtime rtm = Runtime.getRuntime();

long mm = rtm.maxMemory()/1024/1024;

long fm = rtm.freeMemory()/1024/1024;

long tm = rtm.totalMemory()/1024/1024;

out.println("JVM memory info:
");

out.println("Max memory:"+mm+"MB"+"
");

out.println("Free memory:"+fm+"MB"+"
");

out.println("Total memory:"+tm+"MB"+"
");

out.println("Available memory can be used:"+(mm+fm-tm)+"MB"+"
");%>

[root@localhost aa]# firefox www.wjl.com:8080/aa/meminfo.jsp

 

[root@localhost tomcat]# vim bin/catalina.sh

CATALINA_OPTS="-Djava.rmi.server.hostname=192.168.2.10

-Dcom.sun.management.jmxremote

-Dcom.sun.management.jmxremote.port=8080

-Dcom.sun.management.jmxremote.ssl=false

-Dcom.sun.management.jmxremote.authenticate=true"

 

 

 

 

 

 

 

 

 

 

[root@localhost webapps]# vim manager/meta-INF/context.xml

20             allow="192.168.2.*" />

这个应用管理平台和jmx冲突

需要把jmx注释

[root@localhost tomcat]# vim bin/catalina.sh          

[root@localhost webapps]# vim conf/tomcat-users.xml    #登录管理平台的用户目录

倒数第二行添加

 

改成

  

  

  

  

[root@www tomcat]# vim /usr/local/tomcat/conf/server.xml

删除虚拟主机  

host  host

[root@www tomcat]# /usr/local/tomcat/bin/shutdown.sh

[root@www tomcat]# /usr/local/tomcat/bin/startup.sh

[root@www tomcat]# firefox 192.168.2.10:8080/manager/html

 

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5522055.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-13
下一篇 2022-12-13

发表评论

登录后才能评论

评论列表(0条)

保存