tomcat 机器配置;
[root@wx03 lib]# pwd
/usr/local/apache-tomcat-7.0.55/lib
[root@wx03 lib]# ls -ltr *jmx*
-rw-r--r-- 1 root root 9533 Jun 1 12:53 catalina-jmx-remote.jar
编辑catalina.sh,添加jmx配置:
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=5566"
[root@wx03 bin]# netstat -nap | grep 5566
tcp 0 0 0.0.0.0:5566 0.0.0.0:* LISTEN 4009/java
[root@wx03 bin]# ps -ef | grep 4009
root 4009 1 26 12:55 pts/1 00:00:02 /usr/java/jdk1.8.0_20/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-7.0.55/conf/logging.properties -
Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms4096m -Xmx4096m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -
Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=5566 -Djava.endorsed.dirs=/usr/local/apache-tomcat-7.0.55/endorsed -classpath /usr/local/apache-tomcat-
7.0.55/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.55/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/apache-tomcat-7.0.55 -Dcatalina.home=/usr/local/apache-tomcat-7.0.55 -
Djava.io.tmpdir=/usr/local/apache-tomcat-7.0.55/temp org.apache.catalina.startup.Bootstrap start
root 4038 3892 0 12:55 pts/1 00:00:00 grep 4009
[root@wx03 bin]#
zabbix 服务器配置:
然后进入到下面的目录下面进行seeting.sh脚本编辑
zabbix:/root/zabbix-2.2.2/src/zabbix_java# pwd
/root/zabbix-2.2.2/src/zabbix_java
zabbix:/root/zabbix-2.2.2/src/zabbix_java# grep -v "^#" settings.sh
LISTEN_IP="0.0.0.0"
LISTEN_PORT=10052
PID_FILE="/tmp/zabbix_java.pid"
START_POLLERS=5
修改zabbix_server文件:
JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5
启动zabbix_java
找到zabbix_java目录路径,然后执行命令./startup.sh
zabbix:/root/zabbix-2.2.2/src/zabbix_java# ./startup.sh
zabbix:/root/zabbix-2.2.2/src/zabbix_java# netstat -nap | grep 10052
tcp 0 0 :::10052 :::* LISTEN 30862/java
重启zabbix:
zabbix 服务器上测试;
zabbix:/etc/init.d# java -jar /root/cmdline-jmxclient-0.10.3.jar - 120.55.118.6:5566 java.lang:type=Memory NonHeapMemoryUsage
06/01/2016 13:20:39 +0800 org.archive.jmx.Client NonHeapMemoryUsage:
committed: 23330816
init: 2555904
max: -1
used: 22670760
zabbix 服务器上添加:
JMX interfaces 120.55.118.6 Port 5566