我在同一个Linux服务器上安装了zabbix服务器和java网关,并启动了zabbix-server和zabbix-java-gateway服务。操作系统是CentOS 6.5,java是JDK1.6.0_45,IP是192.98.12.240,zabbix服务器和zabbix java网关版本是2.2.9。我已经停止了iptables服务。
然后在zabbix Web控制台中,我添加了一个启用了jmx界面的主机。我的主机IP是192.98.12.198,JMX的帖子是9999.在Jconsole中,我可以连接到这个启用JMX的java应用程序。但是在zabbix Web控制台中,它显示错误:
下面是我的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
下面是我的zabbix_java_gateway.conf
LISTEN_IP=192.98.12.240
LISTEN_PORT=10052
PID_FILE="/var/run/zabbix/zabbix_java.pid"
START_POLLERS=5
下面是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
下面的是我的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
请帮助和谢谢。
ps:我已经将zabbix_server.conf中的JavaGateway更改为localhost或127.0.0.1,我也没有用。
答案 0 :(得分:1)
# 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
注意:确保SELinux或iptables不会阻止请求。
答案 1 :(得分:0)
我自己找到了解决方案。 将-Djava.net.preferIPv4Stack = true添加到VM选项解决问题