zabbix 监控 tomcat

一、zabbix-server 、zabbix-agent安装配置略。

二、server端安装zabbix-java-gateway。

#安装
yum -y install zabbix-java-gateway
#启动
systemctl start zabbix-java-gateway
#开机启动
systemctl enable zabbix-java-gateway

 三、配置zabbix-java-gateway.conf

[root@steven ~] # cat /etc/zabbix/zabbix_java_gateway.conf  | egrep -v '^#|^$'
LISTEN_IP="0.0.0.0"
LISTEN_PORT=10052
PID_FILE="/var/run/zabbix/zabbix_java.pid"
START_POLLERS=5

四、配置zabbix_server.conf

[root@zabbix-research zabbix]# cat /etc/zabbix/zabbix_server.conf | egrep -v '^#|^$'
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
DebugLevel=4
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=127.0.0.1
DBName=zabbix30
DBUser=zabbix
DBPassword=zabbix
StartIPMIPollers=1
JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
CacheSize=128M
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

 五、重启

systemctl restart zabbix-server
systemctl restart zabbix-java-gateway

 

六、配置tomcat,修改/data/app/tomcat/bin/catalina.sh 中JAVA_OPTS为以下内容。

JAVA_OPTS="$JAVA_OPTS -Djava.protocol.handler.pkgs=org.apache.catalina.webresources"

JAVA_OPTS="
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=10.0.1.111
-Dcom.sun.management.jmxremote.port=12345
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"

 

七、添加 catalina-jmx-remote.jar 到 /data/app/tomcat/lib

wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.45/bin/extras/catalina-jmx-remote.jar

 

八、重启tomcat

九、测试

java -jar /usr/local/tomcat/cmdline-jmxclient-0.10.3.jar - 127.0.0.1:12345 java.lang:type=Memory HeapMemoryUsage

jar包下载地址 提取码:f37k

 

十、zabbix前端模板配置:略

 

posted @ 2019-09-19 15:26  Mr-Lee-long  阅读(567)  评论(0编辑  收藏  举报