3

I have installed zabbix server and java gateway in same linux server and started zabbix-server and zabbix-java-gateway service. the OS is CentOS 6.5, java is JDK1.6.0_45, IP is 192.98.12.240, zabbix server and zabbix java gateway version is 2.2.9. I have stop iptables service.

Then in zabbix web console, I added a host that enabled jmx interface. My host IP is 192.98.12.198 and JMX post is 9999. In Jconsole, I can connect to this JMX enabled java application. But in zabbix web console, it show error:

enter image description here

below are my zabbix_server.conf

LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
DebugLevel=4
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
JavaGateway=192.98.12.240
JavaGatewayPort=10052
StartJavaPollers=5
SNMPTrapperFile=/var/log/snmptt/snmptt.log
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts

below are my zabbix_java_gateway.conf

LISTEN_IP=192.98.12.240
LISTEN_PORT=10052
PID_FILE="/var/run/zabbix/zabbix_java.pid"
START_POLLERS=5

below are some snippes of zabbix_server.log

13573:20150321:100114.503 In substitute_key_macros() data:'jmx[java.lang:type=Memory,HeapMemoryUsage.used]'
13573:20150321:100114.503 End of substitute_key_macros():SUCCEED data:'jmx[java.lang:type=Memory,HeapMemoryUsage.used]'
13573:20150321:100114.503 In substitute_simple_macros() data:'9999'
13573:20150321:100114.503 In substitute_simple_macros() data:EMPTY
13573:20150321:100114.503 In substitute_simple_macros() data:EMPTY
13573:20150321:100114.503 In get_values_java() host:'myhost' addr:'192.98.12.198' num:1
13573:20150321:100114.503 getting Java values failed: cannot connect to [[192.98.12.240]:10052]: [13] Permission denied
13573:20150321:100114.503 End of get_values_java()
13573:20150321:100114.503 In deactivate_host() hostid:10106 itemid:23899 type:16
13573:20150321:100114.503 query [txnlev:1] [begin;]
13573:20150321:100114.503 query [txnlev:1] [update hosts set jmx_disable_until=1426903334,jmx_error='cannot connect to [[192.98.12.240]:10052]: [13] Permission denied' where hostid=10106]
13573:20150321:100114.504 query [txnlev:1] [commit;]
13573:20150321:100114.526 deactivate_host() errors_from:1426901309 available:2
13573:20150321:100114.526 End of deactivate_host()
13573:20150321:100114.526 End of get_values():1

below are my zabbix_java_gateway.log

2015-03-21 10:54:29.078 [main] INFO  com.zabbix.gateway.JavaGateway - Zabbix Java Gateway 2.2.9 (revision 52686) has started
2015-03-21 10:54:29.086 [main] DEBUG c.z.gateway.ConfigurationManager - starting to parse configuration parameters
2015-03-21 10:54:29.086 [main] DEBUG c.z.gateway.ConfigurationManager - found pidFile configuration parameter with value '/var/run/zabbix/zabbix_java.pid'
2015-03-21 10:54:29.087 [main] DEBUG c.z.gateway.ConfigurationManager - received pidFile configuration parameter, daemonizing
2015-03-21 10:54:29.088 [main] DEBUG c.z.gateway.ConfigurationManager - found listenIP configuration parameter with value '192.98.12.240'
2015-03-21 10:54:29.089 [main] DEBUG c.z.gateway.ConfigurationManager - found listenPort configuration parameter with value '10052'
2015-03-21 10:54:29.089 [main] DEBUG c.z.gateway.ConfigurationManager - found startPollers configuration parameter with value '5'
2015-03-21 10:54:29.089 [main] DEBUG c.z.gateway.ConfigurationManager - finished parsing configuration parameters
2015-03-21 10:54:29.092 [main] INFO  com.zabbix.gateway.JavaGateway - listening on /192.98.12.240:10052
2015-03-21 10:54:29.097 [main] DEBUG com.zabbix.gateway.JavaGateway - created a thread pool of 5 pollers

Please Help and Thanks.

ps: I had changed JavaGateway in zabbix_server.conf to localhost or 127.0.0.1, I didn't work too.

secondflying
  • 871
  • 1
  • 7
  • 16
  • Judging by the error message, "cannot connect to [[192.98.12.240]:10052]: [13] Permission denied", Zabbix server is not allowed to connect to Java gateway. Could you please check that you can make that connection manually and whether there is nothing like SELinux preventing that connection? – asaveljevs Mar 23 '15 at 07:54

2 Answers2

2
# Modify zabbix_server.conf


JavaGateway=127.0.0.1

# Modify zabbix_java_gateway.conf

LISTEN_IP=127.0.0.1

# Restart Services 
service zabbix-server restart

service zabbix-java-gateway restart

Note : Make sure SELinux or iptables not blocking the requests.

josliber
  • 43,891
  • 12
  • 98
  • 133
Sandip Singh
  • 106
  • 1
  • 7
1

I found the solution myself. Add -Djava.net.preferIPv4Stack=true to the VM options solve the problem

secondflying
  • 871
  • 1
  • 7
  • 16