zabbix_server:
zabbix_server.conf :
# Add
JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5
# restart service
service zabbix_server restart
/usr/sbin/zabbix_java/settings.sh
# modify
LISTEN_IP="0.0.0.0"
LISTEN_PORT=10052
PID_FILE="/tmp/zabbix_java.pid"
START_POLLERS=5
# 启动
/usr/sbin/zabbix_java/startup.sh
####################################
Tomcat & zabbix agent:
# 下载jar包
wget http://xxx/catalina-jmx-remote.jar
# 复制到要监控的tomcat的lib里面,例如cms
cp catalina-jmx-remote.jar /usr/local/tomcat/lib/
# modify /usr/local/tomcat/bin/catalina.sh
Add
CATALINA_OPTS="
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=18097 # jmx端口
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=172.16.2.21" # 客户端(本机)ip地址
# 重启Tomcat
#####################################
zabbixserver端
下载cmdline测试是否可获取到数据:
wget http://repo.typesafe.com/typesafe/repo/cmdline-jmxclient/cmdline-jmxclient/0.10.3/cmdline-jmxclient-0.10.3.jar
# java -jar cmdline-jmxclient-0.10.3.jar - 10.9.2.20:18097 java.lang:type=Memory NonHeapMemoryUsage
04/07/2016 10:37:16 +0800 org.archive.jmx.Client NonHeapMemoryUsage:
committed: 139460608
init: 136773632
max: 318767104
used: 57493856