Zabbix uses JMX to monitor Tomcat

Source: Internet
Author: User

JMX (java Management Extensions), a management interface provided by Java, typically uses JMX to monitor the running state of the system or some aspects of the management system, such as emptying the cache, reloading the configuration file, and so on.

Baidu Encyclopedia Introduction: JMX

Zabbix monitoring machine: OS-------cent6.5 x64

Zabbix------2.4.6, installed using Yum installation.

Monitored by: OS--------cent6.5 x64

Java-------website Download JDK8 installation, attention ....

TOMCAT8-----website Download tar.gz Package


Configuration Zabbix monitoring machine: Yum installed Zabbix is not with Java Gateway, need to download from the official website zabbix-java-gateway its monitoring process as follows

Zabbix_server <-> Java Gateway <-> JMX Server<->java app


Download Java Gateway compile installation

CD zabbix-2.4.6 &&  /configure--enable-java--prefix=/usr/local/zabbix
The installation directory is modified in/usr/local/zabbix, the process may be prompted for missing JAVACC, or some other compilation exception,

The solution is to download the JDK from the Java website (do not use Yum, version too old) installation. Install after completing the Configure process

Make && make install
Enter the compiled Java Gateway Directory
Cd/usr/local/zabbix/sbin/zabbix_java
Modify configuration file
Vim settings.sh
Uncomment the listen_ip=0.0.0.0,listen_port=10052,start_pollers=5.

To start the Java gateway process

./start.sh
viewing processes
PS aux | grep java
Zabbix   22270  0.0  0.0 165464 2988  ?        S    Oct26   0:02 zabbix_server:java poller #1 [got 0 values in 0.000004 sec, idle 5 sec]
Zabbix   22271  0.0  0.0 165464  3032?        S    Oct26   0:02 zabbix_server:java poller #2 [got 0 values in 0.000004 sec, idle 5 sec]
Zabbix   22272
  0.0  0.0 165464  2988?        S    Oct26   0:02 zabbix_server:java poller #3 [got 0 values in 0.000004 sec, idle 5 sec]
Zabbix   22273
  0.0  0.0 165520  3168?        S    Oct26   0:02 zabbix_server:java poller #4 [got 0 values in 0.000005 sec, idle 5 sec]
Zabbix   22274
  0.0  0.0 165516  3100?        S    Oct26   0:02 zabbix_server:java poller #5 [got 0 values in 0.000004 sec, idle 5 sec]

Modify the Zabbix_server file zabbix_server.conf and modify the following

### option:javagateway
#       IP address (or hostname) of the Zabbix Java gateway.
# only       required if Java pollers are started.
# #
Mandatory:no #
Default:
# javagateway=
  javagateway=127.0.0.1

### option:javagatewayport
#       Port that is Zabbix Java Gateway listens on.
# #
Mandatory:no #
range:1024-32767 #
Default:
# javagatewayport=10052
  javagatewayport= 10052

### option:startjavapollers
# Number of       pre-forked instances of Java pollers.
# #
Mandatory:no #
range:0-1000 #
Default:
# startjavapollers=0
  startjavapollers=5
That is, let zabbix_server link to the local 10052 port to communicate with Java_gateway. Reboot zabbix_server Zabbix Configuration complete
Service Zabbix-server Restart

Configure the monitored machine: unzip the download tomcat to the user directory
/root/apache-tomcat-7.0.65
Modify
Conf/server.xml
Add a row under the Server tab
<listener classname= "Org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiregistryportplatform= "12345" rmiserverportplatform= "12346"/>
Modify
bin/catalina.sh
Add one line under execute the requested Command
Catalina_opts= "-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.authenticate=false- dcom.sun.management.jmxremote.ssl=false-djava.rmi.server.hostname=192.168.5.59 "
Here 192.168.5.59 for this monitoring machine IP address, and also recommends that the hosts file 127.0.0.1 increase the machine hostname, otherwise the Java error but does not affect the process run.

Download the Catalina-jmx-remote.jar and put it into

lib/
Perform
/bin/startup.sh
Start the Tomcat process, execute the results
Using catalina_base:   /root/apache-tomcat-7.0.65
using catalina_home:   /root/apache-tomcat-7.0.65
Using Catalina_tmpdir:/root/apache-tomcat-7.0.65/temp
using jre_home:        /usr/java/jdk1.8.0_65
using CLASSPATH:       /root/apache-tomcat-7.0.65/bin/bootstrap.jar:/root/apache-tomcat-7.0.65/bin/tomcat-juli.jar
Tomcat started.

This completes the configuration. Then you use the Debugging Tools Cmdline-jmxclient-0.10.3.jar debug JMX and run on the Zabbix monitor

Java-jar cmdline-jmxclient-0.10.3.jar-192.168.5.59:12345 java.lang:type=runtime  Uptime
Will return Tomcat's uptime

Finally, you can add monitoring in the Zabbix monitor panel using the JMX agent.

Reference

Http://www.aikaiyuan.com/2993.html




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.