客户端操作(被监控端)
1.配置Tomcat JMX
[root@localhost media]# cd /usr/local/tomcat7/bin/
[root@localhost bin]# vi catalina.sh #添加以下几行
97 JAVA_HOME=/usr/local/java/
98 JAVA_BIN=$JAVA_HOME/bin
99 PATH=$PATH:$JAVA_BIN
100 CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
101 export JAVA_HOME JAVA_BIN PATH CLASSPATH
102 CATALINA_OPTS="-server -Xms256m -Xmx512m -XX:PermSize=64M -XX:MaxPermSize=128m
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=12345"
2.启动tomcat,查看启动是否成功
[root@localhost bin]# /usr/local/tomcat7/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat7
Using CATALINA_HOME: /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME: /usr/local/java/
Using CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Tomcat started.
[root@localhost bin]# netstat -antup | grep 12345
tcp 0 0 :::12345 :::* LISTEN 113658/java
服务器操作(监控端)
1.Java 支持
编译安装zabbix server需要加上--enable-java以支持jmx监控.
2.修改settings.sh文件
[root@localhost ~]# cd /usr/local/zabbix-3.0.3/sbin/zabbix_java/
[root@localhost zabbix_java]# vi settings.sh
9 LISTEN_IP="127.0.0.1"
17 LISTEN_PORT=10052
35 START_POLLERS=5
3.修改zabbixserver的配置文件,使支持javagateway
[root@localhost zabbix_java]# cd /usr/local/zabbix-3.0.3/etc/
[root@localhost etc]# vi zabbix_server.conf #最末行添加以下3行
JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5
4.启动javagateway
[root@localhost etc]# /usr/local/zabbix-3.0.3/sbin/zabbix_java/startup.sh
10052
[root@localhost etc]# netstat -antup | grep 10052
tcp 0 0 ::ffff:127.0.0.1:10052 :::* LISTEN 1944/java
5.导入模板
6.调用模板
Ps :如果出现报错修改主机名ip为本机ip
本文出自 “Dream chaser” 博客,请务必保留此出处http://dreamchaser.blog.51cto.com/7756851/1789501
原文地址:http://dreamchaser.blog.51cto.com/7756851/1789501