zabbix uses JMX to monitor tomcat (java class application)

  • This experiment is based on the zabbix monitoring platform has been built and a monitoring host server 3 (agent)
  • If you have any questions, you can check the article [explain the whole process of zabbix installation with pictures and pictures]

zabbix uses JMX to monitor tomcat

  1. Install tomcat and jdk on server3 (client of agent), and open tomcat
[root@server3 ~]# rpm -ivh jdk-8u121-linux-x64.rpm 
[root@server3 ~]# tar zxf apache-tomcat-8.5.24.tar.gz -C /usr/local
[root@server3 ~]# cd /usr/local/
[root@server3 local]# ln -s apache-tomcat-8.5.24/ tomcat    # Make soft connection for easy update
[root@server3 local]# cd tomcat/
[root@server3 tomcat]# cd bin/
[root@server3 bin]# vim catalina.sh       ##Add to tomcatJMXParameters of -–JMXFull name Java Management Extensions, by Java Application provides management extension function
110 CATALINA_OPTS='-Dcom.sun.management.jmxremote
111   -Dcom.sun.management.jmxremote.port=8888      # Monitor port number for remote access
112   -Dcom.sun.management.jmxremote.ssl=false       # Whether to open the connectionSSLEncryption, on by default
113   -Dcom.sun.management.jmxremote.authenticate=false'     # Whether user authentication needs to be enabled,Default opening
[root@server3 bin]# ./startup.sh      ##Start tomcat
[root@server3 bin]# netstat -antlp   ##View port(8888and8080)


2. Install ZABBIX Java gateway on Server1 (server side) and make corresponding configuration

[root@server1 4.0]# yum install -y zabbix-java-gateway-4.0.5-1.el7.x86_64.rpm 

[root@server1 4.0]# cd /etc/zabbix/
[root@server1 zabbix]# vim zabbix_java_gateway.conf   ## Just look at it.

[root@server1 zabbix]# systemctl start zabbix-java-gateway

[root@server1 zabbix]# netstat -antlp | grep :10052
tcp6       0      0 :::10052                :::*                    LISTEN      31199/java 

[root@server1 zabbix]# pwd
/etc/zabbix
[root@server1 zabbix]# vim zabbix_server.conf 
288 JavaGateway=172.25.19.1
296 JavaGatewayPort=10052
304 StartJavaPollers=5

[root@server1 zabbix]# zabbix_server -R config_cache_reload
zabbix_server [365]: command sent successfully
[root@server1 zabbix]# systemctl restart zabbix-server
  1. zabbix monitoring interface is set accordingly




    After the update, JMX on server3 turns green and is normal
  • If JMX does not turn green all the time, you can reload the configuration on the server side (server1) and restart the services on both sides
[root@server1 zabbix]# zabbix_server -R config_cache_reload
zabbix_server [365]: command sent successfully

[root@server1 zabbix]# systemctl restart zabbix-server
[root@server3 zabbix]# systemctl restart zabbix-agent

Tags: Zabbix Tomcat Java RPM

Posted on Mon, 02 Dec 2019 19:38:30 -0500 by warpoet