1. Installing the Java Tools on the Zabix server (servers installed Zabbix)
[Email protected] ~]# RPM-IVH
http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-java-gateway-2.4.7-1.el6.x86_64.rpm
[Email protected] ~]# vim/etc/zabbix/zabbix_server.conf
javagateway=127.0.0.1
javagatewayport=10055
Startjavapollers=5
[Email protected] ~]# vim/etc/zabbix/zabbix_java_gateway.conf
listen_ip= "0.0.0.0"
listen_port=10055
Start_pollers=5
[[email protected] ~]#/etc/init.d/zabbix-server restart
shutting down Zabbix server: [ ok ]
starting Zabbix server: [ ok ]
[[email protected] ~]#/etc/init.d/zabbix-java-gateway restart
shutting down Zabbix Java gateway: [ ok ]
Starting Zabbix Java gateway: [ ok ]
[Email protected] ~]# Netstat-antulp | grep 10055
TCP 0 0::: 10055:::* LISTEN 15958/java
[Email protected] ~]#
2. Add a port on the Tomcat side for Zabbix to get the data
Jmxcmd:
Https://sourceforge.net/projects/jmxcmd/files/latest/download?source=typ_redirect
[[email protected] ~]# vim/usr/local/tomcat-7.0.67/bin/catalina.sh--Add the following line to get the IP address of the Tomcat server
Catalina_opts= "-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.authenticate=false- Dcom.sun.management.jmxremote.ssl=false-djava.rmi.server.hostname= Native IP Address "
[[email protected] ~]# Vim/usr/local/tomcat-7.0.67html/conf/server.xml--exposing a port to Zabbix get data
<listener classname= "Org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiregistryportplatform= "9999" rmiserverportplatform= "9999"/>
[[email protected] ~]#/usr/local/tomcat-7.0.67/bin/shutdown.sh--Close Tomcat service
[[email protected] ~]#/usr/local/tomcat-7.0.67/bin/startup.sh--Start Tomcat service
[Email protected] ~]# Netstat-antulp | grep 9999
TCP 0 0::: 9999:::* LISTEN 12469/java
[Email protected] ~]# Java-jar jmxcmd.jar-localhost:9999 java.lang:type=memory nonheapmemoryusage
04/26/2016 16:21:38 +0800 de.layereight.jmxcmd.Client nonheapmemoryusage:
committed:136183808
init:134676480
max:318767104
used:36691992
[Email protected] ~]#
3. Add categories, items, keys in Zabbix
(1). Enable JMX Module
(2). Create a Category
This article is from the "Days Together" blog, please be sure to keep this source http://tongcheng.blog.51cto.com/6214144/1767930
Monitoring Zabbix using JMX to monitor Tomcat