Zabbix using JMX to monitor Tomcat

Source: Internet
Author: User

Zabbix Monitoring Tomcat Scheme



1) The version of Zabbix is 2.4

You need to add a parameter when compiling Zabbix--enable-java


2) server-side configuration

2.1 Confirm that the JDK is installed

[Email protected] zabbix]# java-version

Java Version "1.7.0_79"

Java (TM) SE Runtime Environment (build 1.7.0_79-b15)

Java HotSpot (TM) 64-bit Server VM (build 24.79-b02, Mixed mode)


2.2 Installing Zabbix-java-gateway

Packages are available in Zabbix, and are currently only supported from the Zabbix software package.

If you have already installed Zabbix, only need to add the next Zabbix-java

#./configure--enable-java--prefix=/opt/zabbix_java

# Make && make install

2.3 Modifying the Java-gateway configuration file

Go to the following directory for seeting.sh script editing

#find/-name Zabbix_java

/usr/sbin/zabbix_java

/usr/src/zabbix-2.4.6/src/zabbix_java

cd/usr/src/zabbix-2.4.6/src/zabbix_java/

#ll

Total 64

Drwxr-xr-x 2 4096 Oct 01:06 bin

Drwxr-xr-x 4 root root 4096 Oct 01:06 class

Drwxr-xr-x 2 4096 16:56 Lib

-rw-r--r--1 root root 15802 Oct 01:05 Makefile

-rw-r--r--1 1310 16:56 makefile.am

-rw-r--r--1 14949 16:57 makefile.in

-rw-r--r--1 788 Oct 09:51 settings.sh

-rwxr-xr-x 1 554 16:56 shutdown.sh

Drwxr-xr-x 3 4096 16:56 src

-rwxr-xr-x 1 2025 16:56 startup.sh

The file is all commented by default, enabling the following items

[Email protected] zabbix_java]# sed-e '/^#/d;/^$/d ' settings.sh

listen_ip= "0.0.0.0"

listen_port=10052

Pid_file= "/tmp/zabbix_java.pid"

Start_pollers=5


2.4 Modify Zabbix_server File

Enable several of these

Sed-e '/^#/d;/^$/d '/etc/zabbix/zabbix_server.conf

Logfile=/tmp/zabbix_server.log

Dbhost=localhost

Dbname=zabbix

Dbuser=zabbix

Dbpassword=zabbix

Dbsocket=/var/lib/mysql/mysql.sock

dbport=3306

javagateway=192.168.18.132

javagatewayport=10052

Startjavapollers=5


2.5 Start Zabbix_java

Locate the Zabbix_java directory path, and then execute the command./startup.sh

#find/-name Zabbix_java

/usr/sbin/zabbix_java

/usr/src/zabbix-2.4.6/src/zabbix_java

#ll

Total 20

Drwxr-xr-x 2 root root 4096 Oct 01:07 bin

Drwxr-xr-x 2 root root 4096 Oct 01:07 Lib

-rw-r--r--1 root root 788 Oct 15:00 settings.sh

-rwxr-xr-x 1 root root 554 Oct 01:07 shutdown.sh

-rwxr-xr-x 1 root root 2025 Oct 01:07 startup.sh

#netstat-TUNLP | grep 10052

TCP 0 0::: 10052:::* LISTEN 2015/java


2.6 Restart Zabbix_server


3) Tomcat terminal, install Catalina-jmx-remote.jar

wget Http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.8/bin/extras/catalina-jmx-remote.jar

Store the downloaded files in the Tomcat subdirectory directory Lib

MV catalina-jmx-remote.jar/opt/tomcat/lib/


4) Modify the catalina.sh file

Modify the vim/opt/tomcat/bin/catalina.sh file

Locate------Execute The requested Command-----add

[$! = "Stop"] && java_opts= "-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=9008- Dcom.sun.management.jmxremote.ssl=false-dcom.sun.management.jmxremote.authenticate=false- djava.rmi.server.hostname=192.168.18.127 $JAVA _opts "

Export java_opts


5) Restart the Tomcat service and ZABBIX_AGENTD service

6) Whether the server-side test can get the information properly

java-jar/usr/src/cmdline-jmxclient-0.10.3.jar-192.168.18.127:9008 java.lang:type=memory NonHeapMemoryUsage

10/30/2015 06:02:34-0400 org.archive.jmx.Client nonheapmemoryusage:

committed:30212096

init:2555904

Max: 1

used:29110528


7) Add a template to


8) template and related software see attached file.


Garbled problem

Zabbix garbled is how to shine it? Zabbix uses Dejavusan.ttf fonts, does not support Chinese, resulting in garbled Chinese. The solution is simple, upload the font file of our computer to the Zabbix server.

1. garbled characters such as

2. Solve Zabbix garbled method

2.1 Uploading files to Zabbix

Locate the local C:\Windows\Fonts\simkai.ttf (in italics) that is uploaded to the server Zabbix site Directory Fonts directory.

2.2 Modifying the Zabbix PHP configuration file

Cd/var/www/html/zabbix My Zabbix installation path

3. View Zabbix garbled processing results


4. Frequently Asked Questions

Still garbled: Through the above operation, most of the students garbled problem solved, but still some students or garbled? An attentive group of friends provides another scenario: the initialization of the database is not caused by the use of UTF8 encoding. Initialize database using commands


Create DATABASE Zabbix default CharSet UTF8;

Or my.cnf Add the following configuration

Default-character-set = UTF8


This article is from the "Guang" blog, make sure to keep this source http://510952.blog.51cto.com/500952/1708210

Zabbix using JMX to monitor Tomcat

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.