Zabbix JMX-based Tomcat monitoring

Source: Internet
Author: User

First, the environment

ubuntu14.04 LTS

Java 1.7.0

Zabbix 2.4.5

Second, installation configuration

  1, installation Javagateway

Under Ubuntu14.04lts because the direct use of the ZABBIX-RELEASE_2.4-1+TRUSTY_ALL.DEB package is installed Zabbix,


Install zabbix-server-mysql zabbix-frontend-php

So to implement JMX only need to install a Zabbix-java-gateway package can


sudo Install Zabbix-java-gateway

If the direct source code is compiled zabbix-2.4.5, you only need


./configure --enable-java --prefix=/usr/local/zabbix/zabbix_java
sudo make && sudo make install

  2, Configuration zabbix_java_gateway.conf



cd /etc/zabbix
sudo vim zabbix_java_gateway.conf

Add:
LISTEN_IP="0.0.0.0"
LISTEN_PORT=10052
PID_FILE="/tmp/zabbix_java.pid"
START_POLLERS=5

where Listen_port and listen_ip can not be configured, Zabbix_java will take the default values. But Pid_file and start_pollers must be configured, especially the idea of start_pollers, if not configured Zabbix_java can still start but is not working.

  3. Configure Zabbix_server or Zabbix_proxy

The configuration file for Zabbix_server or Zabbix_proxy needs to be configured with the following:



JavaGateway=127.0.0.1 SERVER IP
JavaGatewayPort=10052
StartJavaPollers=5

  4. Start Zabbix_java_gateway


sudo Service Zabbix_java_gateway Start

  5, monitoring the start zabbix_java_gateway whether successful

sudo netstat -nutpl | grep 10052
tcp6       0      0 :::10052                :::*                    LISTEN      7681/java  

6. Configuration modification tomcat is monitored

Download catalina-jmx-remote.jar
Store the downloaded file in the tomcat subdirectory directory lib record
Sudo mv catalina-jmx-remote.jar /usr/local/tomcat/apache-tomcat-7.0.53/lib/
Modify the startup script file
Cd /usr/local/tomcat/apache-tomcat-7.0.53/bin
Sudo vim catalina.sh
Add the following to # ----- Execute The Requested Command -----------------
Export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.ssl=false -Djava .rmi.server.hostname=xxxx"
-----Remarks (x.x.x.x is the client ip address, which is the ip address of the tomcat itself, or the host name)
----- The Port here should be consistent with the listening jmx port defined by the zabbix server.

Cd /usr/local/tomcat/apache-tomcat-7.0.53/conf
Sudo vim server.xml
Modify the server.xml configuration file to add the following line
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="12345" rmiServerPortPlatform="12346"/>
----- The Port here should be consistent with the listening jmx port defined by the zabbix server.

Modify the hosts file of the tomcat server
Cat /etc/hosts
192.168.45.127 localhost.localdomain localhost

  7. Restart Tomcat and Zabbix_java_gateway



Sudo /usr/local/tomcat/apache-tomcat-7.0.53/bin/shutdown.sh
If you can't close it, directly sudo killall java
Sudo /usr/local/tomcat/apache-tomcat-7.0.53/bin/startup.sh
Sudo service zabbix-java-gateway restart

  8, in the Zabbix server side with tool testing

Download Cmdline-jmxclient-0.10.3.jar Tools

wget http://repo.typesafe.com/typesafe/repo/cmdline-jmxclient/cmdline-jmxclient/0.10.3/cmdline-jmxclient-0.10.3.jar

Test:

java -jar cmdline-jmxclient-0.10.3.jar - 192.168.45.127:12345 java.lang:type=Memory NonHeapMemoryUsage

06/11/2015 15:49:30 +0800 org.archive.jmx.Client NonHeapMemoryUsage:

committed: 26214400

init: 2555904

max: -1

used: 25515648

Zabbix JMX-based Tomcat monitoring

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.