Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[Zabbix4.2 Learning Notes] 8. Data collection-JMX Agent

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

JMX Agent is used to monitor the application of java class

JMX Agent can realize the standardization and application management of various operating systems, system architectures, network protocols and applications.

Server side configuration:

JAVA Gateway needs to be started during zabbix server installation

Zabbix server configuration launches JAVA Gateway

Zabbix server configuration JAVA Gateway/JAVA GatewayPort parameters

Zabbix server configuration StartJavaPollers parameters

Ensuring IP+Port communication between zabbix server and JMX applications

Configuration of the monitored side:

Enable and correctly configure JMX

Data collection process

ZabbixServer initiates a data acquisition request to the Zabbix Java Gateway component. After receiving the request, Java Gateway will initiate a data request to the monitored Java application.

The monitored end receives the request and responds to the corresponding monitoring data. When Zabbix Java Gateway receives the data, it returns it to ZabbixServer.

Check whether JavaGateway [root @ localhost ~] # rpm-qa is installed on the server | grep zabbix

If it is not installed Installation command: yum-y install zabbix-java-gateway-4.2.6-1.el7.x86_64 can also use yum to find the installation package yum search zabbix to change the configuration file of zabbixJavaGateway [root@localhost zabbix] # grep ^ [Amurz] / etc/zabbix/zabbix_java_gateway.conf LISTEN_IP= "0.0.0.0" LISTEN_PORT=10052PID_FILE= "/ var/run/zabbix/zabbix_java.pid" START_POLLERS=5TIMEOUT=3JAVA_OPTIONS= "$JAVA_OPTIONS-Dcom.sun .management.jmxremote-Dcom.sun.management.jmxremote.port=12345 launch zabbix JavaGateway [root@localhost ~] # systemctl start zabbix-java-gateway.service [root@localhost ~] # systemctl status zabbix-java-gateway.service ● zabbix-java-gateway.service-Zabbix JavaGateway Loaded: loaded (/ usr/lib/systemd/system/zabbix-java-gateway.service) Disabled; vendor preset: disabled) Active: active (running) since II 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. Change the ZabbixServer configuration file [root@localhost zabbix] # grep ^ [amurz] / etc/zabbix/zabbix_server.conf LogFile=/var/log/zabbix/zabbix_server.logLogFileSize=0PidFile=/var/run/zabbix/zabbix_server.pidSocketDir=/var/run/zabbixDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=zabbixStartTrappers=10JavaGateway=192.168.146.133JavaGatewayPort=10052StartJavaPollers=5SNMPTrapperFile=/tmp/zabbix_traps.tmpStartSNMPTrapper=1Timeout=4AlertScriptsPath=/usr/lib/zabbix/alertscriptsExternalScripts=/usr/lib/zabbix/externalscriptsSSHKeyLocation=/home/zabbix/.sshLogSlowQueries=3000StatsAllowedIP=127.0.0.1 to see if the process of Java pollers enables [root@] Localhost ~] # ps-aux | grep javazabbix 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.JavaGatewayzabbix 25593 0.00.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 112724 984 pts/1 S+ 21:06 0:00 grep-- color=auto java installs jdk1.8.0 [root @ localhost ~] # yum-y install java-1.8.0-openjdk java-1.8.0-openjdk-devel [root@localhost ~] # which java/usr/bin/java adds the jdk environment variable [root@localhost ~] # vim / etc/profile to export JAVA_HOME= on the last line / usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64export PATH=$JAVA_HOME/bin:$PATHexport 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 Download and install Tomcat [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 localhost data 25 localhost data 01muri-http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz is in progress Parse the host mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn). 101.6.8.193, 2402:f000:1:408:8100::1 is connecting mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn) | 101.6.8.193 |: 80. Connected. A HTTP request has been issued Waiting for a response. 200 OK length: 9722154 (9.3m) [application/octet-stream] is being saved to: "apache-tomcat-8.5.45.tar.gz" 100% [= = >] 9722154 2.14MB/s 4.3s 2019-09-17 20:25:05 (2.14MB/s)-saved "apache-tomcat-8.5.45.tar.gz" [9722154lap 9722154]) unzip and start Tomcat [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 View Tomcat logs Process [root@localhost data] # vim.. / logs/catalina.out [root@localhost data] # ps aux | grep tomcat configuration Tomcat enables JMX [root @ localhost data] # vim / data/apache-tomcat-8.5.45/bin/catalina.shCATALINA_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 "restart Tomcat [root@localhost bin] #. / shutdown.sh [root@localhost bin] #. / startup.sh creates monitoring items in the front end of zabbixweb management. First, add the monitoring interface corresponding to JMX on the host.

In the latest data, you can see that the monitoring data have been obtained.

× × learning

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report