zabbix监控tomcat:
端口
状态:堆内存 栈内存 线程信息
[root@zagent-tomcat /opt/apache-tomcat-8.0.50]# vim bin/catalina.sh
#!/bin/sh
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=172.16.0.121"
上边这个也是写tomcat自己的IP
-Dcom.sun.management.jmxremote 启动JMX远程监控
-Dcom.sun.management.jmxremote.port=12345 JMX使用的端口
-Dcom.sun.management.jmxremote.ssl=false 不使用SSL加密
-Dcom.sun.management.jmxremote.authenticate=false 不使用验证
-Djava.rmi.server.hostname=172.16.0.121 tomcat自己的IP
为了能够在有防火墙规则的情况下,查看tomcat的状态:
[root@zagent-tomcat /opt/apache-tomcat-8.0.50]# vim conf/server.xml
33 <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />
[root@zagent-tomcat /opt/apache-tomcat-8.0.50]# vim conf/jmxremote.access
admin read write
[root@zagent-tomcat /opt/jdk1.8.0_05/jre/lib/management]# cp jmxremote.password.template jmxremote.password
[root@zagent-tomcat /opt/jdk1.8.0_05/jre/lib/management]# vim jmxremote.password
monitorRole QED
controlRole R&D
打开注释
wq!
下载jar包:
catalina-jmx-remote.jar
[root@zagent-tomcat /opt/apache-tomcat-8.0.50/lib]# ls catalina-jmx-remote.jar
# shutdown.sh
# startup.sh
[root@zagent-tomcat ~]# netstat -antp | grep java
tcp6 0 0 :::8080 :::* LISTEN 1424/java
tcp6 0 0 :::10001 :::* LISTEN 1424/java
tcp6 0 0 :::10002 :::* LISTEN 1424/java
tcp6 0 0 :::12345 :::* LISTEN 1424/java
tcp6 0 0 :::8009 :::* LISTEN 1424/java
然后再监控的主机上添加jmx接口
端口改成10050端口