一、概述
zabbix的三种架构:
1、Server-agent
2、Server-node-agent
3、Server-proxy-agent
Server-proxy-agent:proxy,用于本区域数据收集,并将数据发送给server;
Server-node-agent:node,提供完整的zabbix-server用以建立分布式监控中的层级;
Proxy和Node的比较:
Node本身是一台Server,它有完整的web页面,完整的数据库,它将数据源源不断的传送给Master;
Proxy只有一个proxy的daemon进程,Proxy也有自己的数据库,但它的数据只会保存一定时间,它与Master通信是将一批信息打包后发送到Master,Master将这些数据汇总到Master数据库
Zabbix-Proxy相比Zabbix-Node的优点有以下:
Proxy压力小,数据库只存储一定时间数据;
Proxy压力小,数据不是源源不断获取,减小I/O压力;
架构清晰,易于维护。
Zabbix-Proxy工作特性:
Proxy不会向Server同步Configuration,只会接收数据;
Proxy的数据库定时会将数据传送给Server,Proxy本地数据库只会保存最近没有发送的数据;
二、实验环境
192.168.30.116 OS:Centos6.4 x86_64 zabbix_server.luojianlong.com
192.168.30.115 OS:Centos6.4 x86_64 zabbix_proxy.luojianlong.com
192.168.30.117 OS:Centos6.4 x86_64 node1.luojianlong.com
192.168.30.119 OS:Centos6.4 x86_64 node2.luojianlong.com
首先安装zabbix_server
1
2
|
[root@zabbix_server ~]
# yum -y localinstall zabbix-2.0.8-3.el6.x86_64.rpm zabbix-get-2.0.8-3.el6.x86_64.rpm zabbix-server-2.0.8-3.el6.x86_64.rpm zabbix-server-mysql-2.0.8-3.el6.x86_64.rpm zabbix-web-2.0.8-3.el6.noarch.rpm zabbix-web-mysql-2.0.8-3.el6.noarch.rpm
# 安装数据库,web界面就省略了,前面几篇博客有介绍
|
在zabbix_proxy 上面安装mysql
1
2
3
4
5
6
7
8
9
|
[root@zabbix_proxy ~]
# yum -y install mysql-server
[root@zabbix_proxy ~]
# service mysqld start
# 创建数据库
mysql> create database zabbix_proxy character
set
utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on zabbix_proxy.* to
'zbxuser'
@
'192.168.30.%'
identified by
'123456'
;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
|
安装zabbix_proxy
1
|
[root@zabbix_proxy ~]
# yum -y localinstall zabbix-2.0.8-3.el6.x86_64.rpm zabbix-proxy-2.0.8-3.el6.x86_64.rpm zabbix-proxy-mysql-2.0.8-3.el6.x86_64.rpm
|
导入数据库脚本
1
|
[root@zabbix_proxy ~]
# mysql -u zbxuser -p123456 -h 192.168.30.115 zabbix_proxy < /usr/share/doc/zabbix-proxy-mysql-2.0.8/create/schema.sql
|
修改zabbix_proxy配置文件
1
2
3
4
5
6
7
8
9
10
11
12
|
[root@zabbix_proxy ~]
# vi /etc/zabbix/zabbix_proxy.conf
Hostname=192.168.30.115
DBHost=192.168.30.115
DBName=zabbix_proxy
DBUser=zbxuser
DBPassword=123456
Server=192.168.30.116
[root@zabbix_proxy ~]
# service zabbix-proxy start
Starting Zabbix proxy: [ OK ]
[root@zabbix_proxy ~]
# ss -antpl | grep zabbix
LISTEN 0 128 :::10051 :::*
users
:((
"zabbix_proxy"
,19714,5),(
"zabbix_proxy"
,19821,5),(
"zabbix_proxy"
,19822,5),(
"zabbix_proxy"
,19824,5),(
"zabbix_proxy"
,19825,5),(
"zabbix_proxy"
,19827,5),(
"zabbix_proxy"
,19828,5),(
"zabbix_proxy"
,19829,5),(
"zabbix_proxy"
,19830,5),(
"zabbix_proxy"
,19831,5),(
"zabbix_proxy"
,19832,5),(
"zabbix_proxy"
,19834,5),(
"zabbix_proxy"
,19835,5),(
"zabbix_proxy"
,19836,5),(
"zabbix_proxy"
,19839,5),(
"zabbix_proxy"
,19841,5),(
"zabbix_proxy"
,19842,5),(
"zabbix_proxy"
,19845,5),(
"zabbix_proxy"
,19847,5),(
"zabbix_proxy"
,19848,5),(
"zabbix_proxy"
,19850,5),(
"zabbix_proxy"
,19851,5),(
"zabbix_proxy"
,19853,5))
LISTEN 0 128 *:10051 *:*
users
:((
"zabbix_proxy"
,19714,4),(
"zabbix_proxy"
,19821,4),(
"zabbix_proxy"
,19822,4),(
"zabbix_proxy"
,19824,4),(
"zabbix_proxy"
,19825,4),(
"zabbix_proxy"
,19827,4),(
"zabbix_proxy"
,19828,4),(
"zabbix_proxy"
,19829,4),(
"zabbix_proxy"
,19830,4),(
"zabbix_proxy"
,19831,4),(
"zabbix_proxy"
,19832,4),(
"zabbix_proxy"
,19834,4),(
"zabbix_proxy"
,19835,4),(
"zabbix_proxy"
,19836,4),(
"zabbix_proxy"
,19839,4),(
"zabbix_proxy"
,19841,4),(
"zabbix_proxy"
,19842,4),(
"zabbix_proxy"
,19845,4),(
"zabbix_proxy"
,19847,4),(
"zabbix_proxy"
,19848,4),(
"zabbix_proxy"
,19850,4),(
"zabbix_proxy"
,19851,4),(
"zabbix_proxy"
,19853,4))
|
在node1,node2上分别安装zabbix_agent
1
2
3
4
5
6
7
8
|
[root@node1 ~]
# yum -y localinstall zabbix-2.0.8-3.el6.x86_64.rpm zabbix-sender-2.0.8-3.el6.x86_64.rpm zabbix-agent-2.0.8-3.el6.x86_64.rpm
[root@node2 ~]
# yum -y localinstall zabbix-2.0.8-3.el6.x86_64.rpm zabbix-sender-2.0.8-3.el6.x86_64.rpm zabbix-agent-2.0.8-3.el6.x86_64.rpm
# 修改配置文件
Server=192.168.30.115
[root@node1 ~]
# service zabbix-agent start
Starting Zabbix agent: [ OK ]
[root@node2 ~]
# service zabbix-agent start
Starting Zabbix agent: [ OK ]
|
打开zabbix_server web管理界面
在Administration-->DM中create proxy,Proxy name一定要与zabbix_proxy.conf中的Hostname一致
创建host,Monitored by proxy:选择的是通过zabbix_proxy主机来监控,
添加成功
下面创建自动发现规则,使用zabbix-proxy自动发现主机并添加监控
定义自动添加主机
Action
定义自动移除主机Action
本文转自ljl_19880709 51CTO博客,原文链接:http://blog.51cto.com/luojianlong/1396668,如需转载请自行联系原作者