zabbix-server端的配置注意编译安装zabbix-server的时候,带上参数 --enable-java .
注意,由于你是编译zabbix-java-gateway,所以,你的zabbix服务器是必须要有java环境的。
1
| ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-ssh2 --enable-java
|
修改java的settings.sh参数,
LISTEN_IP="0.0.0.0"
LISTEN_PORT=10052
START_POLLERS=5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| # This is a configuration file for Zabbix Java Gateway.
# It is sourced by startup.sh and shutdown.sh scripts.
### Option: zabbix.listenIP
# IP address to listen on.
#
# Mandatory: no
# Default:
LISTEN_IP="0.0.0.0"
### Option: zabbix.listenPort
# Port to listen on.
#
# Mandatory: no
# Range: 1024-32767
# Default:
LISTEN_PORT=10052
### Option: zabbix.pidFile
# Name of PID file.
# If omitted, Zabbix Java Gateway is started as a console application.
#
# Mandatory: no
# Default:
# PID_FILE=
PID_FILE="/tmp/zabbix_java.pid"
### Option: zabbix.startPollers
# Number of worker threads to start.
#
# Mandatory: no
# Range: 1-1000
# Default:
START_POLLERS=5
### Option: zabbix.timeout
# How long to wait for network operations.
#
# Mandatory: no
# Range: 1-30
# Default:
# TIMEOUT=3
|
修改zabbix_server.conf
1
2
3
4
5
6
7
| LogFile=/tmp/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5
|
都修改好以后,保存并启动java
./startup.sh
查看进程:
[iyunv@mysql src]# netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1080/sshd
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 1386/zabbix_agentd
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 1737/zabbix_server
tcp 0 0 :::22 :::* LISTEN 1080/sshd
tcp 0 0 :::10050 :::* LISTEN 1386/zabbix_agentd
tcp 0 0 :::10051 :::* LISTEN 1737/zabbix_server
tcp 0 0 :::10052 :::* LISTEN 1994/java
tcp 0 0 :::3306 :::* LISTEN 1329/mysqld
tcp 0 0 :::80 :::* LISTEN 1376/httpd
从上我们看到,zabbix_agent,zabbix_server都已经开启,java也开启了,端口是10052
========================================================================================
Tomcat端配置
1.首先配置tomcat环境,注意被控端和服务器端的JDK版本要一致
2.将catalina-jmx-remote.jar 下载,并复制到
/usr/local/tomcat/lib/ 目录下
3.修改TOmcat的catalina.sh文件
1
| CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.1.224"
|
注意,不要根据网上人云亦云,把ssh=false也给加上。
其中,192.168.1.224为tomcat所在PCIP地址,根据你自己的环境改边就行了,你是什么IP就填什么IP
4.修改server.xml
[iyunv@mysql lib]# locate server.xml
/usr/local/tomcat/conf/server.xml
其中加入如下选项:
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="12345" rmiServerPortPlatform="12345"/>
重启tomcat
====================================================================
回到 zabbix服务器:
在zabbix服务器端用工具测试 下载cmdline-jmxclient-0.10.3.jar工具 java -jar /usr/local/src/cmdline-jmxclient-0.10.3.jar - 192.168.1.224:12345 java.lang:type=Memory NonHeapMemoryUsage 11/12/2014 15:39:30 +0800 org.archive.jmx.Client NonHeapMemoryUsage: committed: 552665088 init: 539426816 max: 587202560 used: 75002232
显示有数据,最后在zabbix添加host,填上模板就OK了。
|