您好,登錄后才能下訂單哦!
JMX Agent 用于監控java類的應用
JMX Agent 可以實現各種操作系統,系統架構,網絡協議的標準化和應用管理
zabbix server 安裝時需要啟動JAVA Gateway
zabbix server 配置啟動 JAVA Gateway
zabbix server 配置 JAVA Gateway/JAVA GatewayPort參數
zabbix server 配置 StartJavaPollers參數
保障zabbix server和JMX 應用的IP+Port通信
開啟并正確配置JMX
ZabbixServer向Zabbix Java Gateway 組件發起獲取數據請求,Java Gateway收到請求后會向被監控的Java 應用發起數據請求。
被監控端收到請求,并且響應對應的監控數據。Zabbix Java Gateway收到數據后,會返回給ZabbixServer。
[root@localhost ~]# rpm -qa|grep zabbix
yum -y install zabbix-java-gateway-4.2.6-1.el7.x86_64
yum search zabbix
[root@localhost zabbix]# 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=5
TIMEOUT=3
JAVA_OPTIONS="$JAVA_OPTIONS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345
啟動zabbix JavaGateway
[root@localhost ~]# systemctl start zabbix-java-gateway.service
[root@localhost ~]# systemctl status zabbix-java-gateway.service
● zabbix-java-gateway.service - Zabbix Java Gateway
Loaded: loaded (/usr/lib/systemd/system/zabbix-java-gateway.service; disabled; vendor preset: disabled)
Active: active (running) since 二 2019-09-17 21:00:41 CST; 10s ago
Process: 24955 ExecStart=/usr/sbin/zabbix_java_gateway (code=exited, status=0/SUCCESS)
Main PID: 24959 (java)
CGroup: /system.slice/zabbix-java-gateway.service
└─24959 java -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremot...
9月 17 21:00:39 localhost.localdomain systemd[1]: Starting Zabbix Java Gateway...
9月 17 21:00:41 localhost.localdomain systemd[1]: Started Zabbix Java Gateway.
[root@localhost zabbix]# grep ^[a-Z] /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
StartTrappers=10
JavaGateway=192.168.146.133
JavaGatewayPort=10052
StartJavaPollers=5
SNMPTrapperFile=/tmp/zabbix_traps.tmp
StartSNMPTrapper=1
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
SSHKeyLocation=/home/zabbix/.ssh
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1
[root@localhost ~]# ps -aux|grep java
zabbix 24959 0.7 1.7 3369484 51500 ? Sl 21:00 0:02 java -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -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
zabbix 25593 0.0 0.1 164224 3660 ? S 21:05 0:00 /usr/sbin/zabbix_server: java poller #1 [got 0 values in 0.000071 sec, idle 5 sec]
zabbix 25594 0.0 0.1 164224 3660 ? S 21:05 0:00 /usr/sbin/zabbix_server: java poller #2 [got 0 values in 0.000015 sec, idle 5 sec]
zabbix 25595 0.0 0.1 164224 3660 ? S 21:05 0:00 /usr/sbin/zabbix_server: java poller #3 [got 0 values in 0.000015 sec, idle 5 sec]
zabbix 25596 0.0 0.1 164224 3660 ? S 21:05 0:00 /usr/sbin/zabbix_server: java poller #4 [got 0 values in 0.000030 sec, idle 5 sec]
zabbix 25597 0.0 0.1 164224 3660 ? S 21:05 0:00 /usr/sbin/zabbix_server: java poller #5 [got 0 values in 0.000047 sec, idle 5 sec]
root 25707 0.0 0.0 112724 984 pts/1 S+ 21:06 0:00 grep --color=auto java
[root@localhost ~]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
[root@localhost ~]# which java
/usr/bin/java
[root@localhost ~]# vim /etc/profile
最后一行加入
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@localhost ~]# source /etc/profile
[root@localhost ~]# echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64
[root@localhost data]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz
--2019-09-17 20:25:01-- http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz
正在解析主機 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在連接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:80... 已連接。
已發出 HTTP 請求,正在等待回應... 200 OK
長度:9722154 (9.3M) [application/octet-stream]
正在保存至: “apache-tomcat-8.5.45.tar.gz”
100%[======================================================================>] 9,722,154 2.14MB/s 用時 4.3s
2019-09-17 20:25:05 (2.14 MB/s) - 已保存 “apache-tomcat-8.5.45.tar.gz” [9722154/9722154])
[root@localhost]# mkdir /data
[root@localhost]# cd /data
[root@localhost data]# tar xvf apache-tomcat-8.5.45.tar.gz
[root@localhost data]# cd bin/
[root@localhost bin]# ./startup.sh
[root@localhost data]# vim ../logs/catalina.out
[root@localhost data]# ps aux|grep tomcat
[root@localhost data]# vim /data/apache-tomcat-8.5.45/bin/catalina.sh
CATALINA_OPTS="$CATALINA_OPTS
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=12345
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=192.168.146.134"
[root@localhost bin]# ./shutdown.sh
[root@localhost bin]# ./startup.sh
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。