Zabbix Monitoring Tomcat
Zabbix_server adds support for Java
(1) zabbix adds support for java:
Add-enable-java at compile time for zabbix_server
[root@prx02 zabbix-3.0.3] # / configure-- prefix=/usr/local/zabbix-- enable-server-- enable-agent-- with-mysql-- enable-ipv6-- with-net-snmp-- with-libcurl-- with-libxml2-- enable-java
(2) configure zabbix_server.conf:
[root@localhost zabbix_java] # vim / usr/local/zabbix/etc/zabbix_server.conf
Modify the following items:
JavaGateway=127.0.0.1JavaGatewayPort=10052StartJavaPollers=5
(3) start zabbix_java:
[root@localhost zabbix_java] # cd / usr/local/zabbix/sbin/zabbix_java/ [root @ localhost zabbix_java] # vim / usr/local/zabbix/sbin/zabbix_java/settings.sh
Start these items:
LISTEN_IP= "0.0.0.0" LISTEN_PORT=10052PID_FILE= "/ tmp/zabbix_java.pid" START_POLLERS= 5 [root @ localhost zabbix_java] #. / startup.sh
Restart zabbix_server:
[root@localhost zabbix_java] # service zabbix_server restart second configure Tomcat of zabbix client
(1) add catalina-jmx-remote.jar to the tomcat to be monitored:
[root@localhost tmp] # wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.70/bin/extras/catalina-jmx-remote.jar[root@sevA lib] # mv / tmp/catalina-jmx-remote.jar / usr/local/apache-tomcat-h6/lib
(2) modify the catalina.sh file of the tomcat client:
[root@sevA apache-tomcat-h6] # vim / usr/local/apache-tomcat-h6/bin/catalina.sh
Add to the top of the file:
Export CATALINA_OPTS= "$CATALINA_OPTS-Dcom.sun.management.jmxremote-Dcom.sun.management.jmxremote.port=12000-Dcom.sun.management.jmxremote.ssl=false-Dcom.sun.management.jmxremote.authenticate=false-Djava.rmi.server.hostname=192.168.1.232"
Note:
Port 12000 refers to the port through which zabbix_server acquires data, which is needed when configuring the web interface.
192.168.1.232 refers to the IP address where the tomcat is located.
(3) start tomcat:
[root@sevA bin] # / usr/local/apache-tomcat-h6/bin/startup.sh III get data by testing on zabbix_server
(1) download cmdline-jmxclient-0.10.3.jar:
Address: http://pan.baidu.com/s/1nvGWeO5
(2) use cmdline-jmxclient to obtain data in zabbix_server:
[root@localhost zabbix] # java-jar cmdline-jmxclient-0.10.3.jar-192.168.1.232 java.lang:type=Memory NonHeapMemoryUsage 12000 java.lang:type=Memory NonHeapMemoryUsage
The output is as follows:
07Accord 06 org.archive.jmx.Client NonHeapMemoryUsage:committed 14:03:21 + 0800 web: 52559872init: 24576000max: 136314880used: 51997824 four-zabbix web interface configuration
(1) add JMX interface to the host:
(2) Link TOMCAT template:
Switch to the templates tab and select the tomcat/JMX template that comes with zabbix (PS: if the port of tomcat has been changed, you need to re-copy the original template and modify the key and port number)
Q: how do I monitor multiple Tomcat instances on the same host?
You only need to completely copy a set of tomcat templates that come with tomcat, and then rename keys and key values (PS: because two identical Key are not allowed in zabbix), and mainly modify several port numbers corresponding to your application.
(3) the final effect is as follows:
Reference article:
Http://www.bfish.net/2016/05/zabbix-jvm-tomcat.html
PS: the watermark in the above picture is the domain name of my personal blog, so please show mercy not to mark me as "reprinted article", thank you!