Search code examples
javajmxzabbix

Zabbix JMX monitoring host is not reachable


I am trying to use Zabbix monitor a Java application by JMX interface. I started java application with command like below:

java -Dcom.sun.management.jmxremote.port=9999 \
 -Dcom.sun.management.jmxremote.rmi.port=9999 \
 -Dcom.sun.management.jmxremote=true \
 -Dcom.sun.management.jmxremote.local.only=false \
 -Dcom.sun.management.jmxremote.ssl=false \
 -Dcom.sun.management.jmxremote.authenticate=false \
 -Djava.rmi.server.hostname=$HOST_IP \
 -jar $MY_JAR

I am able to connect to it using visualVM remote monitor by adding $HOST_IP:9999. However, I cannot connect to it in the Zabbix JMX interface with the same setting. Is there any other setting we need to do in the Zabbix or do we need to run any agent in the java application server? Thanks.


Solution

  • I just found that I need to enable and configure the Java gateway in the Zabbix server as zabbix server docker by setting up the following variables:

    ZBX_JAVAGATEWAY_ENABLE=true
    ZBX_JAVAGATEWAY=zabbix-java-gateway
    ZBX_JAVAGATEWAYPORT=10052
    ZBX_STARTJAVAPOLLERS=5
    

    Thanks