1. Introduction
The zabbix monitoring installed half a year ago, at that time, cooperated with the testers in different places to do a stress test on the A project. It mainly monitored the memory, CPU information of several servers deployed by the project, and later network I/O, etc., and did not consider the JVM; I have been idle recently. , I want to improve the monitoring, so keep this record.
Second, zabbix-server configuration
To install zabbix-java-gateway, you only need to add "--enable-java" when installing zabbix-server. Since zabbix-server has been installed, you need to recompile and install it here:
cd /soft/zabbix/zabbix-3.4.1 ./configure --enable-java --prefix=/usr/local/zabbix-3.4.1/zabbix_java make && make install
First change the settings.sh file of the zabbix-java-gateway program:
vim /usr/local/zabbix-3.4.1/zabbix_java/sbin/zabbix_java/settings.sh LISTEN_IP="0.0.0.0" LISTEN_PORT=10052 PID_FILE="/tmp/zabbix_java.pid" START_POLLERS=5
zabbix-java-gateway is an independent service, so start zabbix-java:
cd /usr/local/zabbix-3.4.1/zabbix_java/sbin/zabbix_java/ ./startup.sh
Change the zabbix_server.conf configuration, uncomment lines 242, 250, and 258, and configure as follows;
vim /usr/local/zabbix-3.4.1/etc/zabbix_server.conf ······ JavaGateway = 127.0 . 0.1 JavaGatewayPort = 10052 StartJavaPollers = 5 ......
Restart zabbix_server
/etc/init.d/zabbix_server restart
Three, zabbix_agent configuration
In fact, the configuration on the zabbix_agent side is more agent than the agent, that is to configure the relevant information of JMX in the tomcat startup file:
vim /data/tomcat8/bin/catalina.sh CATALINA_OPTS="$CATALINA_OPTS -Djavax.management.builder.initial= -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname={ZABBIX_AGENT_IP}"
After adding the above configuration, restart tomcat to take effect;
Fourth, zabbix_server side verification
Verify through cmdline-jmxclinet (download address: http://crawler.archive.org/cmdline-jmxclient/cmdline-jmxclient-0.10.3.jar):
java -jar /tmp/cmdline-jmxclient-0.10.3.jar - {ZABBIX_AGENT_IP}:12345 java.lang:type=Memory NonHeapMemoryUsage
The display is as follows:
Five, zabbix page configuration
Configure JMX information:
Add JMX template:
At this point, wait about ten minutes to draw the picture.
Six, JMX template import
JMX's own template is not easy to view, so use the template introduced on the Internet:
Copy the above template to html and import it into zabbix:
Then you can select this template in the host, and you will not repeat the operation here, just draw the picture directly