Java教程

zabbix-基于Java Gateway监控Tomcat

本文主要是介绍zabbix-基于Java Gateway监控Tomcat,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 安装

[root@zabbix-server ~]# yum -y install zabbix-java-gateway.x86_64

 修改javagateway配置文件

[root@zabbix-server alertscripts]# grep "^[a-Z]" /etc/zabbix/zabbix_java_gateway.conf
LISTEN_IP="0.0.0.0"
LISTEN_PORT=10052
PID_FILE="/var/run/zabbix/zabbix_java.pid"
START_POLLERS=20    # 启动进程数量
TIMEOUT=30  # 超时时间

 启动

[root@zabbix-server alertscripts]# systemctl  start zabbix-java-gateway.service
[root@zabbix-server alertscripts]# systemctl  enable  zabbix-java-gateway.service

 修改zabbix server配置

JavaGateway=192.168.64.111
JavaGatewayPort=10052
StartJavaPollers=20   # 多进程 

 tomcat开启JMX监控,端口为12345

  vim catalina.sh

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

 启动

[root@master-3 bin]# ./catalina.sh start
Using CATALINA_BASE:   /usr/local/apache-tomcat-8.5.61
Using CATALINA_HOME:   /usr/local/apache-tomcat-8.5.61
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.61/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/apache-tomcat-8.5.61/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.61/bin/tomcat-juli.jar
Using CATALINA_OPTS:    -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=192.168.64.112 -Dcom.sun.management.jmxremote.port=12345  -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Tomcat started.

[root@master-3 bin]# ps -ef |grep tomcat
root      30997      1 69 21:47 pts/0    00:00:03 /usr/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-8.5.61/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=192.168.64.112 -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dignore.endorsed.dirs= -classpath /usr/local/apache-tomcat-8.5.61/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.61/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/apache-tomcat-8.5.61 -Dcatalina.home=/usr/local/apache-tomcat-8.5.61 -Djava.io.tmpdir=/usr/local/apache-tomcat-8.5.61/temp org.apache.catalina.startup.Bootstrap start
root      31033  30398  0 21:47 pts/0    00:00:00 grep --color=auto tomcat

[root@master-3 bin]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:41071         0.0.0.0:*               LISTEN      1100/containerd
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      681/rpcbind
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1311/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1079/sshd
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1088/cupsd
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      30997/java
tcp6       0      0 :::35110                :::*                    LISTEN      30997/java
tcp6       0      0 :::35853                :::*                    LISTEN      30997/java
tcp6       0      0 :::111                  :::*                    LISTEN      681/rpcbind
tcp6       0      0 :::8080                 :::*                    LISTEN      30997/java
tcp6       0      0 :::22                   :::*                    LISTEN      1079/sshd
tcp6       0      0 :::12345                :::*                    LISTEN      30997/java

添加主机

 添加模板

 

这篇关于zabbix-基于Java Gateway监控Tomcat的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!