#安裝 yum -y install zabbix-java-gateway #啓動 systemctl start zabbix-java-gateway #開機啓動 systemctl enable zabbix-java-gateway
[root@steven ~] # cat /etc/zabbix/zabbix_java_gateway.conf | egrep -v '^#|^$' LISTEN_IP="0.0.0.0" LISTEN_PORT=10052 PID_FILE="/var/run/zabbix/zabbix_java.pid" START_POLLERS=5
4、配置zabbix_server.conf前端
[root@zabbix-research zabbix]# cat /etc/zabbix/zabbix_server.conf | egrep -v '^#|^$' LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 DebugLevel=4 PidFile=/var/run/zabbix/zabbix_server.pid DBHost=127.0.0.1 DBName=zabbix30 DBUser=zabbix DBPassword=zabbix StartIPMIPollers=1 JavaGateway=127.0.0.1 JavaGatewayPort=10052 StartJavaPollers=5 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log CacheSize=128M Timeout=4 AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000
5、重啓java
systemctl restart zabbix-server systemctl restart zabbix-java-gateway
6、配置tomcat,修改/data/app/tomcat/bin/catalina.sh 中JAVA_OPTS爲如下內容。web
JAVA_OPTS="$JAVA_OPTS -Djava.protocol.handler.pkgs=org.apache.catalina.webresources" JAVA_OPTS=" -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=10.0.1.111 -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
7、添加 catalina-jmx-remote.jar 到 /data/app/tomcat/libapache
wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.45/bin/extras/catalina-jmx-remote.jar
8、重啓tomcattomcat
9、測試app
java -jar /usr/local/tomcat/cmdline-jmxclient-0.10.3.jar - 127.0.0.1:12345 java.lang:type=Memory HeapMemoryUsage
jar包下載地址 提取碼:f37k測試
10、zabbix前端模板配置:略rest