zabbix监控Tomcat

编辑tomcat启动配置文件,开启监控

vi /opt/tomcat7/bin/catalina.sh 

CATALINA_OPTS="$CATALINA_OPTS
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=192.168.1.104
-Dcom.sun.management.jmxremote.port=12345
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"

yum安装zabbix 

yum install  zabbix-server zabbix-agent httpd -y
编辑配置文件 
/etc/httpd/conf.d/zabbix.conf, uncomment and set the right timezone for you.
php_value date.timezone ASia/Shanghai
systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd

http://192.168.1.106/zabbix/setup.php
Admin zabbix

Zabbix 的JMX监控架构
zaibbix Server-->Java gateway-->Tomcay(JMX counter)

yum安装zabbix-java-gateway

[root@node2 zabbix]# ps -ef|grep zabbix_java_gateway
zabbix     9851      1  0 08:21 ?        00:00:29 java -server -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml -classpath lib:lib/android-json-4.3_r3.1.jar:lib/logback-classic-0.9.27.jar:lib/logback-core-0.9.27.jar:lib/slf4j-api-1.6.1.jar:bin/zabbix-java-gateway-4.2.6.jar -Dzabbix.pidFile=/var/run/zabbix/zabbix_java.pid -Dzabbix.startPollers=5 -Dsun.rmi.transport.tcp.responseTimeout=3000 com.zabbix.gateway.JavaGateway
root      12826   8401  0 10:57 pts/0    00:00:00 grep --color=auto zabbix_java_gateway
[root@node2 zabbix]# netstat -lntp|grep 10052
tcp6       0      0 :::10052                :::*                    LISTEN      9851/java           
[root@node2 zabbix]# 

配置重启zabbix-java-gateway

[root@node2 zabbix]# vi /etc/zabbix/zabbix_java_gateway.conf 
START_POLLERS=5

配置重启zabbix-server
[root@node2 zabbix]# vi /etc/zabbix/zabbix_server.conf  
JavaGateway=127.0.0.1 
JavaGatewayPort=10052
 StartJavaPollers=3
systemctl restart zabbix-java-gateway.service
systemctl enable zabbix-java-gateway.service
systemctl restart zabbix-server zabbix-agent httpd