zabbix分布式项目proxy

一、zabiix分布式原理图:

zabbix分布式就相当于在基础环境中搭建了一个中转站zabbix-porxy,porxy可以把其监控项全部收纳起来,等待zabbix-server服务器的读取。(用分布式项目优势,可以在内网中对要进行监控的服务器进行监控)

zabbix分布式管理原理图.png

二、准备实验环境:

zabbix分布式管理环境部署图.png

服务器角色 ip 服务器名
zabbix-server 10.0.0.71 zabbix
zabbix-proxy 10.0.0.7/172.16.1.7 web01
zabbix-agent 172.16.1.20 web02-jk

需要部署的程序:
zabbix-server 部署的程序:zabbix-server-mysql 、zabbix-web-mysql、mariadb-server、httpd(内外网都需要)
zabbix-proxy 部署的程序:mariadb-server、zabbix-proxy(内外网都需要)
zabbix-agent 部署的程序:zabbix-agent、把外网关闭(只保存内网172.16.1.20)

1、 zabbix-server的搭建在第59课已经有搭建过,这里不做说明。

2、 zabbix-proxy的环境部署(在web01上部署):

2.1 官网下载zabbix源:

image.png

2.2 修改zabbix.repo源:

[root@web01 yum.repos.d]# vim zabbix.repo 

[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0

2.3 安装zabbix-proxy:

[root@web01 yum.repos.d]# yum install -y zabbix-proxy-mysql
[root@web01 yum.repos.d]# rpm  -qa zabbix-proxy-mysql
zabbix-proxy-mysql-4.0.10-1.el7.x86_64

2.4 安装mariadb-server:

[root@web01  ]# yum install -y mariadb-server
[root@web01 yum.repos.d]# rpm  -qa mariadb-server
mariadb-server-5.5.60-1.el7_5.x86_64

2.5 优化数据库(mysql安全初始化):

[root@zabbix yum.repos.d]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
     SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] n
... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

2.6 创建数据库:

[root@web01 ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix_proxy  charset utf8;
MariaDB [(none)]> grant  all on zabbix_proxy.*  to zabbix_proxy@localhost  identified  by '123456';
MariaDB [(none)]> select user,host from mysql.user;
+--------------+------------+
| user         | host       |
+--------------+------------+
| root         | 127.0.0.1  |
| bbs          | 172.16.1.% |
| root         | ::1        |
| bbs          | localhost  |
| root         | localhost  |
| zabbix_proxy | localhost  |
| root         | web01      |
+--------------+------------+
7 rows in set (0.02 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bbs                |
| mysql              |
| performance_schema |
| test               |
| zabbix_proxy       |
+--------------------+
6 rows in set (0.00 sec)

2.7 导入初始化数据库并启动数据库、设置开机自启:

[root@web01 ~]# zcat /usr/share/doc/zabbix-proxy-mysql-4.0.10/schema.sql.gz |mysql -uzabbix_proxy  -p123456  zabbix_proxy
[root@web01 ~]#systemctl  start  mariadb.server
[root@web01 ~]#systemctl  enable  mariadb.server

2.8 修改zabbix-proxy配置文件,启动proxy,并开机自启:


84AAC784-8B7E-426b-A371-DFFDAC6CD622.png
[root@web01 ~]# systemctl  start zabbix-proxy
[root@web01 ~]# systemctl  enable  zabbix-proxy

2.9 修改zabbix-agent配置文件, 启动zabbix-agent服务并设置开机自启:


zabiix-agent配置.png
[root@web01 ~]# systemctl  start zabbix-proxy
[root@web01 ~]# systemctl  enable  zabbix-proxy

2.10 添加hosts解析:

zabbix-server服务器上添加:
10.0.0.7 web01 sh-porxy

zabbix-proxy(web01)服务器上添加:
172.16.1.20 web02-jk

2.11 zabbix-server服务器的web端配置如下:


zabbix监控分布式配置1-1.png
zabbix监控分布式配置1-2.png
zabbix监控分布式配置2-1.png
zabbix监控分布式配置2-2.png
zabbix监控分布式配置2-3.png
zabbix监控分布式配置2-4.png

2.12 检测数据:


zabbix监控分布式配置3.png
zabbix监控分布式配置4.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 220,809评论 6 513
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 94,189评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 167,290评论 0 359
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,399评论 1 294
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,425评论 6 397
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 52,116评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,710评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,629评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 46,155评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,261评论 3 339
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,399评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 36,068评论 5 347
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,758评论 3 332
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,252评论 0 23
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,381评论 1 271
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,747评论 3 375
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,402评论 2 358

推荐阅读更多精彩内容