Zabbix Monitor the configuration of the JMX Tomcat environment

Source: Internet
Author: User
Tags egrep

JDK download page

Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.rpm? Authparam=1462948138_871b75d4b1dd7155e8cbe4f23e5cd2cd
Script

[Root@nfs-web1 latest]# Vim/etc/profile.d/java
Export Java_home=/usr/java/latest
Export path= $JAVA _home/bin/: $PATH
Apache-tomcat Installation
Download Tomcat

wget Http://mirror.rise.ph/apache/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz-C/usr/local/
cd/usr/local/
Tar XF apache-tomcat-7.0.69.tar.gz
LN-SV apache-tomcat-7.0.69 Tomcat
' Tomcat '-> ' apache-tomcat-7.0.67 '
View Help:

[Root@nfs-web1 tomcat]# bin/catalina.sh--help
Start:

[Root@mysql-master local]# CD tomcat/
[Root@mysql-master tomcat]# bin/catalina.sh start
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using Jre_home:/usr/java/latest
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[Root@mysql-master tomcat]# ss-tlnp|grep Java
LISTEN 0 1:: ffff:127.0.0.1:8005:::* Users: (("Java", 7498,51)
LISTEN 0:: 8009:::* Users: (("Java", 7498,47)
LISTEN 0:: 8080:::* Users: (("Java", 7498,46)
[Root@mysql-master tomcat]# JPS
7794 Jps
7498 Bootstrap
[Root@mysql-master tomcat]#
Yum installation Zabbix

Yum install Zabbix zabbix-server zabbix-web zabbix-agent zabbix-web-mysql zabbix-get zabbix-sender zabbix-java-gateway
Compiling installation Zabbix requires--enable=java
The Zabbix configuration file is modified as follows:

[Root@localhost zabbix]# egrep-v "^$|^#|^%" zabbix_server.conf
Logfile=/var/log/zabbix/zabbix_server.log
Logfilesize=0
Pidfile=/var/run/zabbix/zabbix_server.pid
Dbname=zabbix
Dbuser=zuser
Dbpassword=password
javagateway=192.168.158.131
javagatewayport=10052
Startjavapollers=5
Snmptrapperfile=/var/log/snmptt/snmptt.log
Alertscriptspath=/usr/lib/zabbix/alertscripts
Externalscripts=/usr/lib/zabbix/externalscripts
Java_gateway

[Root@localhost zabbix]# egrep-v "^$|^#|^%" zabbix_java_gateway.conf
listen_ip= "0.0.0.0"
listen_port=10052
Pid_file= "/var/run/zabbix/zabbix_java.pid"
Start_pollers=5
Zabbix_agentd

[Root@localhost zabbix]# egrep-v "^$|^#|^%" zabbix_agentd.conf
Pidfile=/var/run/zabbix/zabbix_agentd.pid
Logfile=/var/log/zabbix/zabbix_agentd.log
Logfilesize=0
server=127.0.0.1
serveractive=127.0.0.1
Hostname=zabbix Server
include=/etc/zabbix/zabbix_agentd.d/
[Root@localhost zabbix]#
To modify the catalina.sh, add a clause as follows:

/usr/local/tomcat/bin/catalina.sh
Catalina_opts= "-dcom.sun.management.jmxremote-djava.rmi.server.hostname=192.168.158.131
-dcom.sun.management.jmxremote.authenticate=false
-dcom.sun.management.jmxremote.ssl=false
-dcom.sun.management.jmxremote.port=12345 "
Start all services

[Root@localhost zabbix]#/etc/init.d/zabbix-server Restart
Shutting down Zabbix server: [OK]
Starting Zabbix server: [OK]
[Root@localhost zabbix]#/etc/init.d/zabbix-agent Restart
Shutting down Zabbix agent: [OK]
Starting Zabbix agent: [OK]
[Root@localhost zabbix]#/etc/init.d/zabbix-java-gateway Restart
Shutting down Zabbix Java gateway: [OK]
Starting Zabbix Java gateway: [OK]
[OK]
[Root@localhost zabbix]#/usr/local/tomcat/bin/shutdown.sh
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using jre_home:/usr
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[Root@localhost zabbix]#/usr/local/tomcat/bin/startup.sh
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using jre_home:/usr
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
Ensure 10052 and 12345 ports start successfully

[Root@localhost zabbix]# ss-tlnp|grep Java
LISTEN 0:: 10052:::* Users: (("Java", 55501,11)
LISTEN 0 1:: ffff:127.0.0.1:8005:::* Users: (("Java", 55572,57)
LISTEN 0:: 58855:::* Users: (("Java", 55572,21)
LISTEN 0:: 8009:::* Users: (("Java", 55572,50)
LISTEN 0:: 8080:::* Users: (("Java", 55572,49)
LISTEN 0:: 12345:::* Users: (("Java", 55572,20)
LISTEN 0:: 48922:::* Users: (("Java", 55572,19)
[Root@localhost zabbix]#
Download Cmdline-jmxclient-0.10.3.jar Test

wget Http://crawler.archive.org/cmdline-jmxclient/cmdline-jmxclient-0.10.3.jar
[Root@localhost local]# Java-jar cmdline-jmxclient-0.10.3.jar-localhost:12345 java.lang:type=memory Nonheapmemoryusage
05/12/2016 06:51:21-0700 org.archive.jmx.Client nonheapmemoryusage:
committed:46137344
init:2555904
Max:-1
used:44601840

[Root@localhost local]#
Wget-p/usr/local/tomcat/lib/http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.69/bin/extras/catalina-jmx-remote.jar
The display effect is as follows:

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.