您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。