zabbix監控tomcat,jmx JavaGateway not host
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 --enable-java
make
make install
2: 驗證有沒有安裝java gateway
ll -h /usr/local/zabbix/sbin/zabbix_java/
3: 啟動java gateway
/usr/local/zabbix/sbin/zabbix_java/startup.sh
netstat -tulnp #端口10052
4: zabbix server配置新增(/usr/local/zabbix/etc/zabbix_server.conf),監控流程是zabbix server --> java gateway --> 監控tomcat服務器
JavaGateway=127.0.0.1 ##否則jmx會顯示JavaGateway not host
JavaGatewayPort=10052
StartJavaPollers=5
需要重啟zabbix server。
5: tomcat服務器加入如下配置(vim /usr/local/tomcat/bin/catalina.sh),重啟tomcat
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=12345 -Djava.rmi.server.hostname=144.202.119.71"
6: cmdline-jmxclient-0.10.3.jar測試能否獲取jmx數據(cd /usr/local/tomcat/)
java -jar cmdline-jmxclient-0.10.3.jar - 144.202.119.71:12345 java.lang:type=Memory
java -jar cmdline-jmxclient-0.10.3.jar - 144.202.119.71:12345 java.lang:type=Memory HeapMemoryUsage
java -jar cmdline-jmxclient-0.10.3.jar - 144.202.119.71:12345 java.lang:type=OperatingSystem ProcessCpuLoad
zabbix監控tomcat,jmx JavaGateway not host