Search code examples
tomcat6jmxzabbix

How to JMX monitoring Tomcat6 with zabbix 3.4


I've been trying to monitor a server with Tomcat6 thanks to JMX probe of a zabbix server.

On the zabbix server side there is: zabbix-server3.4 / zabbix-java-gateway On the Tomcat server side there is: zabbix-agent / tomcat6


Configuration of the zabbix_java_gateway.conf:

LISTEN_IP="11.11.150.99"
START_POLLERS=5

I saw on some tutorials that I add to modify the configuration of the catalina.sh file so I replaced:

CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"

with

   CATALINA_OPTS="$CATALINA_OPTS\
                -Dcom.sun.management.jmxremote \
                -Djava.rmi.server.hostname=11.11.150.152 \
                -Dcom.sun.management.jmxremote.port=10052 \
                -Dcom.sun.management.jmxremote.ssl=false \
                -Dcom.sun.management.jmxremote.authenticate=false \
                -Djava.rmi.server.hostname=11.11.150.152"

Host with Tomcat6 to monitor (let's call him T6): 11.11.150.152 OS: Ubuntu 10.01.4 LTS

The host configuration of T6 on the Zabbix server:

Agents: Zabix Agent is enable, SNMP too, JMX is red:" cannot connect to [[11.11.150.152]:10052]: [111] Connection refused"

Configuration of T6:

Name: T6
Agent interface: 11.11.150.152:10050 -working (green)
Agent interface: 11.11.150.152:161 -working (green)
Agent interface: 11.11.150.152:10052 -not working (red)

Configuration of Zabbix Server:

Name: Zabbix server
Agent interface: 11.11.150.99:10050 -working (green)

I tried to debug with tcpdump using: tcpdump -i eth0 host 11.11.150.99 and port 10052 and I get:

14:01:11.365982 IP (tos 0x0, ttl 64, id 32717, offset 0, flags [DF], proto TCP (6), length 60)
    zabbix.eco.local.34636 > sva2.eco.local.10052: Flags [S], cksum 0x0224 (correct), seq 1624311701, win 29200, options [mss 1460,sackOK,TS val 23820376 ecr 0,nop,wscale 7], length 0
14:01:11.366002 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    sva2.eco.local.10052 > zabbix.eco.local.34636: Flags [R.], cksum 0x55c7 (correct), seq 0, ack 1624311702, win 0, length 0

So they are communicating but T6 kind of reject my zabbix server request.

What do I miss?


UPDATE: I changed the port in the catalina conf file to 12345. Now I get this error message:

java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 11.11.150.152; nested exception is: java.net.ConnectException: Connexion refusée (Connection refused)]


My JMX interface is: [IP] 11.11.150.152 [PORT] 12345


Solution

  • Follow this chinese man tutorial and enjoy!

    http://www.justfbt.com/2015/10/28/Monitoring-tomcat-By-zabbix/