0% found this document useful (0 votes)
270 views

Zabbix - Java-Gateway Installation and Tomcat Monitoring

This document discusses the installation and configuration of Zabbix Java Gateway and monitoring of Tomcat using JMX. It provides instructions for installing OpenJDK, downloading and installing the Zabbix Java Gateway RPM, configuring the Zabbix server to communicate with the gateway. It also explains how to enable JMX monitoring on Tomcat by adding a JAR file and configuration, and configure the Zabbix frontend to collect JMX metrics from Tomcat.

Uploaded by

Shoeb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
270 views

Zabbix - Java-Gateway Installation and Tomcat Monitoring

This document discusses the installation and configuration of Zabbix Java Gateway and monitoring of Tomcat using JMX. It provides instructions for installing OpenJDK, downloading and installing the Zabbix Java Gateway RPM, configuring the Zabbix server to communicate with the gateway. It also explains how to enable JMX monitoring on Tomcat by adding a JAR file and configuration, and configure the Zabbix frontend to collect JMX metrics from Tomcat.

Uploaded by

Shoeb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Zabbix -java-gateway installation and Tomcat monitoring.

Version:
Document version:1.1
Zabbix -java –gateway =3.4.6
OpenJDK version=1.8

JDK installation:
Lets install latest open JDK from the base repository.
#sudo yum install java-1.8.0-openjdk-devel
location of bin file : /usr/lib/jvm/java-openjdk/bin
Location of lib file: /usr/lib/jvm/java-openjdk/jre/lib

Zabbix -java-gateway installation


1.Lets download RPM of Zabbix-java-gateway from the zabbix repository.
#wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-java-gateway-3.4.6-
1.el7.x86_64.rpm
2. Install this rpm.
#rpm -ivh zabbix-java-gateway-3.4.6-1.el7.x86_64.rpm
3. We will get two conf. File in /etc/zabbix
zabbix_java_gateway.conf, zabbix_java_gateway_logback.xml
4.Configuration at zabbix_server.conf
Edit zabbix_server.conf
JavaGateway=127.0.0.1 //Javagateway is in same server of zabbix server or IP of java
Gateway server.
JavaGatewayPort=10052 //java gateway port (default)
StartJavaPollers=5 //Java Pollers.
5.Now check the status of zabbix-java-gateway
# systemctl status zabbix-java-gateway
6.Let restart zabbix-java-gateway.
#service zabbix-java-gateway restart
7.we can check log of zabbix-java-gateway or below process
#netstat -anlp |grep 10052
8.We can also check zabbix-java-gateway log in below location.
#tail –f /var/log/zabbix/zabbix_java_gateway.log

As We want to Monitor tomcat, We need enable jmx monitoring of tomcat.


So lets do it.
1.download and install catalina-jmx-remote.jar
# wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.8/bin/extras/catalina-jmx-
remote.jar
2. Mv the jar file to /usr/local/jakarta-tomcat-7.0.61/lib/
3. Edit /usr/local/jakarta-tomcat-7.0.61/conf/server.xml and add(at line: 35):Just put
where you find like <Listener> in server.xml
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
rmiRegistryPortPlatform="8090" rmiServerPortPlatform="8090" />

4.Edit /usr/local/tomcat7/bin/catalina.sh and add (anywhere) the follow lines:


export CATALINA_OPTS="-Dcom.sun.management.jmxremote -
Dcom.sun.management.jmxremote.authenticate=false -
Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.1.28 -
Dcom.sun.management.jmxremote.port=12345"
N.B: IP will be same server ip where Catalina is running. Mention port as per wish.
5.Now Restart the tomcat and check log/catalina.out where you will find jmxproxy has
been started with the mention port.

That’s all in server side 😃.

Web panal configuration:


1.Add host just like you add.
2.Add the configured host ip and port that you have added in catalina.sh.

3.Then click on add and its done.

Now check JMX is green or RED.If you get just like below parameter then its done.

How can check JMX data?


We can check JMX data in 3 way.
1.Jconsole.
2.http://192.168.56.102/manager/jmxproxy //need to configure first.
3.JMXterm client.
Jconsole Procedure.
1.To check using JConsole,Just install jdk in your computer(not in vm/server).
2.Then go to C:\Program Files\Java\jdk1.8.0_111\bin
3. Here you will get jconsole application.
4.You will get a window just like below pic.

5.Now put the IP and port that you have configured in catalina.sh and click on connect.

You will get you desired data with beautiful graph 😄.

Now http://192.168.56.102/manager/jmxproxy configuration.


You just edit /usr/local/jakarta-tomcat-7.0.61/conf/tomcat-users.xml and add the
line.Please be informed that you have to use mentioned username and password.
<role rolename="admin"/>
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<role rolename="manager-jmx"/>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="admin-gui,manager-
gui,manager-jmx"/>

Now restart tomcat and paste the url into the browser.Paste the username and
password you will get jmx data.

Now JMXterm client.


1. Download jmxterm-1.0.0-uber.jar from the below link.
https://sourceforge.net/projects/cyclops-group/files/jmxterm/1.0.0/jmxterm-
1.0.0-uber.jar/download
2. Now run the jar using below command.
#java -jar jmxterm-1.0.0-uber.jar
3. Now you follow the below command
$>open 192.168.56.102:12345
#Connection to 192.168.56.102:12345 is opened
$>domains
#following domains are available
Catalina
JMImplementation
Users
com.sun.management
java.lang
java.nio
java.util.logging
$>domain Catalina
#domain is set to Catalina
$>beans
#domain = Catalina:
Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,j2eeTy
pe=Filter,name=Tomcat WebSocket (JSR356) Filter

$>bean Catalina:context=/host-manager,host=localhost,type=Manager
#bean is set to Catalina:context=/host-manager,host=localhost,type=Manager
$>info
#mbean = Catalina:context=/host-manager,host=localhost,type=Manager
#class name = org.apache.tomcat.util.modeler.BaseModelMBean
# attributes
%0 - activeSessions (int, r)
%1 - className (java.lang.String, r)
%2 - distributable (boolean, rw)
%3 - duplicates (int, rw)

$>get activeSessions
#mbean = Catalina:context=/host-manager,host=localhost,type=Manager:
activeSessions = 0;

You might also like