Phase 3 Basics
Time: July 20, 2023
Participants: the whole class
Contents:
Zabbix monitors tomcat through JMX
Table of contents
Zabbix monitors tomcat through JMX
Second, modify the zabbix server configuration file
Four, Zabbix-web configuration
Zabbix monitors tomcat through JMX
In server.zabbix.com, we have added the --enabled-java option and arranged the java environment when compiling, so we will not describe too much
1. Configure the java gateway
cd /usr/local/zabbix/sbin/zabbix_java/
ls
vim settings.sh
The configuration is as follows:
Second, modify the zabbix server configuration file
cd
vim /usr/local/zabbix/etc/zabbix_server.conf
// add end line
The configuration is as follows:
Restart zabbix_server and zabbix_agentd after completion
killall -9 zabbix_server
killall -9 zabbix_agentd
zabbix_agentd
zabbix_server
sh /usr/local/zabbix/sbin/zabbix_java/startup.sh //start configuration script
netstat -anpt | grab 10052
// Check port 10052 successfully started
3. Install tomcat
(1) Download and install the tomcat software package
java -version
javac -version
which java
tar xf apache-tomcat-8.5.16.tar.gz
mv apache-tomcat-8.5.16 /usr/local/tomcat/
(2) Modify the tomcat startup script
vim /usr/local/tomcat/bin/catalina.sh
The configuration is as follows:
explain:
CATALINA_OPTS="$CATALINA_OPTS
-Dcom.sun.management.jmxremote ## Enable remote monitoring
JMX-Dcom.sun.management.jmxremote.port=12345 #jmx remote port, Zabbix must be consistent when added
-Dcom.sun.management.jmxremote.authenticate=false #Do not enable user password authentication
-Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.59.137" #Run tomcat service IP (do not fill in wrong)
(3) Start tomcat
/usr/local/tomcat/bin/catalina.sh start
netstat -anpt | grab LIST | grab java
Mainly depends on whether port 12345 is enabled
Four, Zabbix-web configuration
Add JMX information
import template
Add a template for server-side huyang1
Wait for a while and the effect is as follows (1-2 minutes)
View tomcat output situation
Other JVM items can be displayed for garbage collection