Zabbix and JMX connection refused

Viewed 1372

I have Zabbix server and on localhost is running a java-gateway but Zabbix can't check any JMX data becouse it says:

cannot connect to [[localhost]:10052]: [111] Connection refused

but if I use a Python script from https://zabbix.org/wiki/Docs/howto/zabbix_get_jmx, I got my values. Here my config:

zabbix-server.conf:

JavaGateway=localhost
JavaGatewayPort=10052
StartJavaPollers=5

javaGateway.conf:

JavaGateway=localhost
LISTEN_PORT=10052

From logs I can se if I use Zabbix GUI to check JMX data, nothing happens in java_gateway logs. It looks like it's not able to connect but I don't know why.

2 Answers

Problem solved by changing zabbix-server.conf from:

JavaGateway=localhost

To:

JavaGateway=127.0.0.1

Note that lot of people has similar issues believing that the zabbix-java-gateway is running while it's not.

Be sure to have the process running and listening on port 10052:

netstat -anolp | grep :10052

If it does not print anything, install the zabbix-java-gateway package and start it.

In Debian/Ubuntu-based:

sudo apt install zabbix-java-gateway
sudo systemctl start zabbix-java-gateway

In Centos:

sudo yum install zabbix-java-gateway
sudo systemctl enable --now zabbix-java-gateway

Then try again.

Related