Installing zabbix-java-gateway
on Centos 6.5
How does zabbix-java-gateway
work?
- First we configure system which needs to be monitored using the
JAVA_OPTS
.- Next we add a
JMX Interface
in Zabbix server UI underhosts
.zabbix-server
will communicate withzabbix-java-gateway
which intern communicates to the system/server where we need to get all the JMX data.- JMX is set using the
JAVA_OPTS
.
[Zabbix-Server] --(port:10053)--> [zabbix-java-gateway] --(port:12345)--> [JMX enabled server, Example:Tomcat/WebServer]
Step 1 : Install zabbix-java-gateway
on zabbix-server
[ahmed@ahmed-server ~]$ sudo yum install zabbix-java-gateway
Step 2 : Configure the host
with JMX
which needs to be monitored.
Setting Tomcat/JMX Options. Add the below lines to
So when the
setenv.sh
and save it under apache-tomcat-7/bin/
So when the
start.sh
is started then these JMX
options will be added to tomcat
server.
NOTE: To make the monitoring secure use ssl and authentication options. You can find more information in the links at the end of this post.
IMPORTANT Lines are below. We will be getting data from port
12345
. -Dcom.sun.management.jmxremote\
-Dcom.sun.management.jmxremote.port=12345\
-Dcom.sun.management.jmxremote.authenticate=false\
-Dcom.sun.management.jmxremote.ssl=false"
But here are the complete
JAVA_OPTS
. you can ignore the first few lines which sets the Heap Memory size. export JAVA_OPTS="$JAVA_OPTS\
-server\
-Xms1024m\
-Xmx2048m\
-XX:MaxPermSize=256m\
-XX:MaxNewSize=256m\
-XX:NewSize=256m\
-XX:SurvivorRatio=12\
-Dcom.sun.management.jmxremote\
-Dcom.sun.management.jmxremote.port=12345\
-Dcom.sun.management.jmxremote.authenticate=false\
-Dcom.sun.management.jmxremote.ssl=false"
Step 3 : Configuring zabbix-server
.
- Here we configure the zabbix server to let it know where the
zabbix-java-gateway
is running.- Since we are running the
zabbix-java-gateway
in the same server aszabbix-server
, so we will be using the sameip
for both.- Only difference is that
zabbix-java-gateway
will be running on port10053
Configuration in
zabbix-server.conf
. Add the below line. Rather un-comment them and add the IP/ports ### Option: JavaGateway
# IP address (or hostname) of Zabbix Java gateway.
# Only required if Java pollers are started.
#
# Mandatory: no
# Default:
JavaGateway=10.10.18.27
### Option: JavaGatewayPort
# Port that Zabbix Java gateway listens on.
#
# Mandatory: no
# Range: 1024-32767
# Default:
JavaGatewayPort=10053
### Option: StartJavaPollers
# Number of pre-forked instances of Java pollers.
#
# Mandatory: no
# Range: 0-1000
# Default:
StartJavaPollers=5
Step 4 : Configuring zabbix-java-gateway
.
- We now set where the
zabbix-java-gateway
will be running and which port it will be listing on.- Configuration in
zabbix-java-gateway
, here sameip
as thezabbix-server
and port10053
.
### Option: zabbix.listenIP
# IP address to listen on.
#
# Mandatory: no
# Default:
LISTEN_IP="10.10.18.27"
### Option: zabbix.listenPort
# Port to listen on.
#
# Mandatory: no
# Range: 1024-32767
# Default:
LISTEN_PORT=10053
### Option: zabbix.pidFile
# Name of PID file.
# If omitted, Zabbix Java Gateway is started as a console application.
#
# Mandatory: no
# Default:
# PID_FILE=
PID_FILE="/var/run/zabbix/zabbix_java.pid"
### Option: zabbix.startPollers
# Number of worker threads to start.
#
# Mandatory: no
# Range: 1-1000
# Default:
START_POLLERS=5
Useful Links:
https://www.zabbix.com/documentation/2.4/manual/concepts/java
https://www.zabbix.com/documentation/2.4/manual/config/items/itemtypes/jmx_monitoring
ku
ReplyDeleteHello ,
ReplyDeleteI am not able to enable the JMX interface, the button is shown RED, tried multiple ports, but the issue continiues.
~~~~~~~~~~~~~~~~~~~
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The error obtained is of above.
Any help will be greatly appreciated.
Thanks