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

Zabbix uses jmx to monitor multiple tomcat

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

Share

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

Zabbix comes with part of the monitoring of JMX. If you want to use this template to monitor tomcat more easily, you can consider using this template.

Unlike other applications that use zabbix-agent, monitoring JMX requires the use of zabbix-java-gateway to interact with the JMX of the system to obtain data. Zabbix-server establishes a communication connection through 10052 (the default port) of java-gateway, and java-gateway acquires data through 12345 (default port) of the remote host JMX. You need to use this Java command line argument here

"- Dcom.sun.management.jmxremote.port" is set on the remote host (JMX). It is usually configured in the JAVA_OPTS environment variable. It is important to note that java-gateway acts only as a proxy for forwarding data and does not cache any data.

Here three machines are used to monitor multiple tomcat, one as zabbix-server and the other two as tomcat servers. By default, all machines have been installed with zabbix server and zabbix-agent (see my previous article for details), and tomcat.

Tip: in a zabbix-server environment, only one zabbix-java-gateway can act as a proxy.

Monitoring JMX configuration steps

1. Install and configure zabbix-java-gateway on the zabbix server (you can also install it on other machines separately).

2. Configure parameters related to tomcat server JMX service

3. Zabbix-serve configure zabbix-gateway.

4. Add monitoring to zabbix web

Install and configure zabbix-java-gateway on the Zabbix server

1. Download the official software package and install it:

Wget http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-java-gateway-3.2.4-2.el7.x86_64.rpmyum install zabbix-java-gateway-3.2.4-2.el7.x86_64.rpm

2. Check the installation path. The rpm package is installed in the / usr/share/zabbix-java-gateway/ directory by default.

Rpm-qpl zabbix-java-gateway-3.2.4-2.el7.x86_64.rpm cd / usr/share/zabbix-java-gateway/bin/

3. Start zabbix-java-gateway. The default listening port is 10052. If you need to modify the port, you can refer to this link.

Systemctl start zabbix-java-gateway

Configure parameters related to tomcat JMX service

1. Modify the tomcat configuration file to enable JMX

Add the following to the vim / usr/local/tomcat7/bin/catalina.sh # file: CATALINA_OPTS= "$CATALINA_OPTS-Dcom.sun.management.jmxremote # enable jmx remote monitoring-Dcom.sun.management.jmxremote.port=12345-Dcom.sun.management.jmxremote.authenticate=false # password-free authentication-Dcom.sun.management.jmxremote.ssl=false-Djava.rmi.server.hostname=192.168.56.11" # tomcat server IP

Using the same configuration on another tomcat, IP is changed to the local public network IP, where IP is the interface of JMX Interface.

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

2. Restart the tomcat server and open port 1234 of JMX.

Cd / usr/local/tomcat7/bin/./shutdown.sh./startup.sh

Zabbix-serve configuration zabbix-gateway

1. Modify the configuration file of zabbix-server as follows

Grep "^ [Amurz]" / usr/local/zabbix_server/etc/zabbix_server.confLogFile=/tmp/zabbix_server.logDBName=zabbixDBUser=zabbixDBPassword=zabbixJavaGateway=127.0.0.1 # the default port StartJavaPollers=5 # JVM of IPJavaGatewayPort=10052 # JavaGateway of the server where JavaGateway resides to monitor the number of polling instances. Default is 0. It is disabled and Timeout=4LogSlowQueries=3000 needs to be enabled.

2. Restart zabbix-server

Killall zabbix_server./zabbix_server-c / usr/local/zabbix_server/etc/zabbix_server.conf

Zabbix web add Monitoring

Add a host in the web interface, and add a JMX template on the host:

Add two JMX templates that come with the system to the host template:

In the display screen, you can see the image monitoring options that have been automatically added:

After configuring these templates, some parameters are not available by default, which requires us to modify the monitoring project. I have a specific configuration process in zabbix using templates to monitor tomcat.

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